31 time_t now = time(
nullptr);
33 auto* bytes =
reinterpret_cast<unsigned char*
>(&now);
36 for(
size_t byte_index = 0; byte_index <
sizeof(time_t); byte_index++)
45 : index(0),
state {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
47 for(
U32 state_index = 0; state_index < 16; ++state_index)
49 state[state_index] = seed * state_index;
58 U32 b = a ^ c ^ (a << 16) ^ (c << 15);
62 U32 d = a ^ ((a << 5) & 0xDA442D24UL);
65 state[
index] = a ^ b ^ d ^ (a << 2) ^ (b << 18) ^ (c << 28);
95 s = v1 * v1 + v2 * v2;
96 }
while(s >= 1.0f ||
is_zero(s));
98 s =
sqrt((-2.0f * std::log(s)) / s);
136 const auto dist = r->get_next_float01() * 0.5f;
138 return vec2f {dist *
cos(angle) + 0.5f, dist *
sin(angle) + 0.5f};
146 const auto dist =
sqrt(r->get_next_float01()) * 0.5f;
148 return vec2f {dist *
cos(angle) + 0.5f, dist *
sin(angle) + 0.5f};
float get_random_gaussian_float01(Random *rand)
T get_random_in_range(Random *rand, const Range< T > &range)
vec2f get_random_point_on_unit_circle_center_focused(Random *r)
float cos(const Angle &ang)
float sin(const Angle &ang)
bool is_within(const Range< T > &range, T value)
size2f max(const size2f lhs, const size2f rhs)
constexpr Range< float > r11
float get_random_gaussian(Random *rand, float mean, float std_dev)
vec2f get_random_point_on_unit_circle_uniform(Random *r)
constexpr float from_percent_of_360() const
WEL512 Random Number Generator.
Random(U32 seed=generate_time_seed())
static U32 generate_time_seed()