Vowpal Wabbit
Public Member Functions | Private Attributes | List of all members
rand_state Struct Reference

#include <global_data.h>

Public Member Functions

constexpr rand_state ()
 
 rand_state (uint64_t initial)
 
constexpr uint64_t get_current_state () const noexcept
 
float get_and_update_random ()
 
float get_random () const
 
void set_random_state (uint64_t initial) noexcept
 

Private Attributes

uint64_t random_state
 

Detailed Description

Definition at line 355 of file global_data.h.

Constructor & Destructor Documentation

◆ rand_state() [1/2]

constexpr rand_state::rand_state ( )
inline

Definition at line 361 of file global_data.h.

361 : random_state(0) {}
uint64_t random_state
Definition: global_data.h:358

◆ rand_state() [2/2]

rand_state::rand_state ( uint64_t  initial)
inline

Definition at line 362 of file global_data.h.

362 : random_state(initial) {}
uint64_t random_state
Definition: global_data.h:358

Member Function Documentation

◆ get_and_update_random()

float rand_state::get_and_update_random ( )
inline

Definition at line 364 of file global_data.h.

References merand48().

364 { return merand48(random_state); }
float merand48(uint64_t &initial)
Definition: rand48.cc:16
uint64_t random_state
Definition: global_data.h:358

◆ get_current_state()

constexpr uint64_t rand_state::get_current_state ( ) const
inlinenoexcept

Definition at line 363 of file global_data.h.

363 { return random_state; }
uint64_t random_state
Definition: global_data.h:358

◆ get_random()

float rand_state::get_random ( ) const
inline

Definition at line 365 of file global_data.h.

References merand48_noadvance().

365 { return merand48_noadvance(random_state); }
float merand48_noadvance(uint64_t v)
Definition: rand48.cc:24
uint64_t random_state
Definition: global_data.h:358

◆ set_random_state()

void rand_state::set_random_state ( uint64_t  initial)
inlinenoexcept

Definition at line 366 of file global_data.h.

366 { random_state = initial; }
uint64_t random_state
Definition: global_data.h:358

Member Data Documentation

◆ random_state

uint64_t rand_state::random_state
private

Definition at line 358 of file global_data.h.


The documentation for this struct was generated from the following file: