Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
2912713a9This file is pinned to the selected release. Download the original to open it in your design tool.
#pragma once
namespace System {
class Random {
public:
constexpr Random()
: state(0)
{};
void seed(uint32_t seed) {
state = seed;
}
uint32_t next(void) {
/* Linear congruential generator */
state = (22695477 * state + 1);
return state;
}
private:
uint32_t state;
};
}