Vowpal Wabbit
Functions | Variables
rand48.cc File Reference
#include <cstdint>

Go to the source code of this file.

Functions

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

Variables

constexpr uint64_t a = 0xeece66d5deece66dULL
 
constexpr uint64_t c = 2147483647
 
constexpr int bias = 127 << 23
 

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

Variable Documentation

◆ a

constexpr uint64_t a = 0xeece66d5deece66dULL

◆ bias

constexpr int bias = 127 << 23

Definition at line 14 of file rand48.cc.

Referenced by merand48(), and query_decision().

◆ c

constexpr uint64_t c = 2147483647

Definition at line 12 of file rand48.cc.

Referenced by ezexample::addns(), MULTICLASS::bufcache_label(), MULTILABEL::bufcache_label(), CB::bufcache_label(), COST_SENSITIVE::bufcache_label(), no_label::bufcache_no_label(), bufcache_simple_label(), MULTILABEL::bufread_label(), MULTICLASS::bufread_label(), CB::bufread_label(), COST_SENSITIVE::bufread_label(), no_label::bufread_no_label(), bufread_simple_label(), MULTICLASS::cache_label(), MULTILABEL::cache_label(), CB::cache_label(), COST_SENSITIVE::cache_label(), CCB::cache_label(), CB_EVAL::cache_label(), cache_simple_label(), cache_tag(), cb_algs_setup(), VW::copy_example_data(), CSOAA::csoaa_setup(), GEN_CS::gen_cs_example(), GEN_CS::gen_cs_example_dr(), namedlabels::get(), ezexample::hash(), CB_ALGS::learn_eval(), TC_parser< audit >::maybeFeature(), merand48(), VW::move_feature_namespace(), multipredict(), LEARNER::learner< CB_EXPLORE::cb_explore, example >::multipredict(), GD::multipredict(), mwt_setup(), output_byte(), CB_ALGS::output_example(), CB_EXPLORE::output_example(), output_features(), parse_cache(), parse_dictionary_argument(), parse_feature_tweaks(), CB_ALGS::predict_or_learn(), predict_or_learn(), MWT::predict_or_learn(), Search::read_allowed_transitions(), read_cached_features(), MULTICLASS::read_cached_label(), MULTILABEL::read_cached_label(), CB::read_cached_label(), COST_SENSITIVE::read_cached_label(), CB_EVAL::read_cached_label(), read_cached_simple_label(), save_load_regularizer(), spoof_hex_encoded_namespaces(), VW::to_argv(), GD::vec_add_multipredict(), and GD::vec_add_trunc_multipredict().