LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
line::rng::JavaRandom Class Reference

java.util.Random, the 48-bit LCG of the Java Language Specification. More...

#include <line/util/rng_ssj.h>

Public Member Functions

 JavaRandom (long long seed=0)
void set_seed (long long seed)
 Java's setSeed: scramble by 0x5DEECE66D and mask to 48 bits.
int32_t next (int bits)
 Java's next(bits).
int32_t next_int ()
 Java's nextInt().
int32_t next_int (int32_t bound)
 Java's nextInt(bound), including the rejection loop it documents.
double next_double ()
 Java's nextDouble(): a 26-bit and a 27-bit draw.
int64_t next_long ()
 Java's nextLong().
bool next_boolean ()
 Java's nextBoolean().
double next_gaussian ()
 Java's nextGaussian(), the polar method with its cached second value.

Detailed Description

java.util.Random, the 48-bit LCG of the Java Language Specification.

The engine uses 23 of these alongside the MRG streams, for the choices that are draws rather than variates: which batch size a BMAP service releases, which branch a probabilistic route takes, and so on. Transcribed rather than approximated, for the same reason as above.

Definition at line 168 of file rng_ssj.h.

Constructor & Destructor Documentation

◆ JavaRandom()

line::rng::JavaRandom::JavaRandom ( long long seed = 0)
inlineexplicit

Definition at line 170 of file rng_ssj.h.

References set_seed().

Member Function Documentation

◆ next()

int32_t line::rng::JavaRandom::next ( int bits)
inline

Java's next(bits).

Definition at line 179 of file rng_ssj.h.

Referenced by next_boolean(), next_double(), next_int(), next_int(), and next_long().

◆ next_boolean()

bool line::rng::JavaRandom::next_boolean ( )
inline

Java's nextBoolean().

Definition at line 213 of file rng_ssj.h.

References next().

◆ next_double()

double line::rng::JavaRandom::next_double ( )
inline

Java's nextDouble(): a 26-bit and a 27-bit draw.

Definition at line 202 of file rng_ssj.h.

References next().

Referenced by next_gaussian().

◆ next_gaussian()

double line::rng::JavaRandom::next_gaussian ( )
inline

Java's nextGaussian(), the polar method with its cached second value.

Definition at line 216 of file rng_ssj.h.

References next_double().

◆ next_int() [1/2]

int32_t line::rng::JavaRandom::next_int ( )
inline

Java's nextInt().

Definition at line 185 of file rng_ssj.h.

References next().

◆ next_int() [2/2]

int32_t line::rng::JavaRandom::next_int ( int32_t bound)
inline

Java's nextInt(bound), including the rejection loop it documents.

Definition at line 188 of file rng_ssj.h.

References line::InputError::InputError(), and next().

◆ next_long()

int64_t line::rng::JavaRandom::next_long ( )
inline

Java's nextLong().

Definition at line 208 of file rng_ssj.h.

References next().

◆ set_seed()

void line::rng::JavaRandom::set_seed ( long long seed)
inline

Java's setSeed: scramble by 0x5DEECE66D and mask to 48 bits.

Definition at line 173 of file rng_ssj.h.

Referenced by JavaRandom().


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