Vowpal Wabbit
Functions
rand48.h File Reference

Go to the source code of this file.

Functions

float merand48 (uint64_t &initial)
 
float merand48_noadvance (uint64_t v)
 

Function Documentation

◆ merand48()

float merand48 ( uint64_t &  initial)

Definition at line 16 of file rand48.cc.

References a, bias, and c.

Referenced by cheesyrand(), cheesyrbit(), random_positive_wrapper< T >::func(), random_weights_wrapper< T >::func(), polar_normal_weights_wrapper< T >::func(), set_rand_wrapper< T >::func(), set_initial_lda_wrapper< T >::func(), rand_state::get_and_update_random(), merand48_noadvance(), and predict_or_learn_multi().

17 {
18  static_assert(sizeof(int) == sizeof(float), "Floats and ints are converted between, they must be the same size.");
19  initial = a * initial + c;
20  int32_t temp = ((initial >> 25) & 0x7FFFFF) | bias;
21  return reinterpret_cast<float&>(temp) - 1;
22 }
constexpr uint64_t a
Definition: rand48.cc:11
constexpr int bias
Definition: rand48.cc:14
constexpr uint64_t c
Definition: rand48.cc:12

◆ merand48_noadvance()

float merand48_noadvance ( uint64_t  v)

Definition at line 24 of file rand48.cc.

References merand48().

Referenced by rand_state::get_random().

24 { return merand48(v); }
float merand48(uint64_t &initial)
Definition: rand48.cc:16