Photon Quantum 3.0.0

Public Member Functions | Static Public Member Functions | Static Public Attributes | Properties | List of all members
Photon.Deterministic.RNGSession Struct Reference

PCG32 random generator, 16 bytes in size. http://www.pcg-random.org More...

Public Member Functions

 RNGSession (Int32 seed)
 Create a new RNGSession with the given seed. More...
 
override int GetHashCode ()
 Overrides the default hash function. More...
 
FP Next ()
 Returns a random FP within [0.0, 1.0). More...
 
FP Next (FP minInclusive, FP maxExclusive)
 Returns a random FP within [minInclusive , maxExclusive ). More...
 
Int32 Next (Int32 minInclusive, Int32 maxExclusive)
 Returns a random int within [minInclusive , maxExclusive ]. More...
 
FP NextInclusive ()
 Returns a random FP within [0.0, 1.0]. More...
 
FP NextInclusive (FP minInclusive, FP maxInclusive)
 Returns a random FP within [minInclusive , maxInclusive ]. More...
 
Int32 NextInclusive (Int32 minInclusive, Int32 maxInclusive)
 Returns a random int within [minInclusive , maxInclusive ]. More...
 
override string ToString ()
 Returns a string representation of the RNGSession. More...
 

Static Public Member Functions

static void Serialize (void *ptr, IDeterministicFrameSerializer serializer)
 Serializes a RNGSession into a IDeterministicFrameSerializer to write or read from a frame snapshot. More...
 

Static Public Attributes

const UInt32 MAX = UInt32.MaxValue
 The maximum possible value to generate. More...
 
const int SIZE = 16
 The size of the struct in-memory inside the Frame data-buffers or stack (when passed as value parameter). Not related to the snapshot payload this occupies, which is bit-packed and compressed. More...
 

Properties

RNGSession Peek [get]
 Returns a copy of this RNGSession, can be used to check what next random values will be without affecting the state. More...
 

Detailed Description

PCG32 random generator, 16 bytes in size. http://www.pcg-random.org

Constructor & Destructor Documentation

◆ RNGSession()

Photon.Deterministic.RNGSession.RNGSession ( Int32  seed)
inline

Create a new RNGSession with the given seed.

Parameters
seedThe random number generator seed.

Member Function Documentation

◆ Next() [1/3]

FP Photon.Deterministic.RNGSession.Next ( )

Returns a random FP within [0.0, 1.0).

Returns
A random FP within [0.0, 1.0)

◆ NextInclusive() [1/3]

FP Photon.Deterministic.RNGSession.NextInclusive ( )

Returns a random FP within [0.0, 1.0].

Returns
A random FP within [0.0, 1.0]

◆ Next() [2/3]

FP Photon.Deterministic.RNGSession.Next ( FP  minInclusive,
FP  maxExclusive 
)
inline

Returns a random FP within [minInclusive , maxExclusive ).

Returns
A random FP within [minInclusive , maxExclusive )

◆ NextInclusive() [2/3]

FP Photon.Deterministic.RNGSession.NextInclusive ( FP  minInclusive,
FP  maxInclusive 
)
inline

Returns a random FP within [minInclusive , maxInclusive ].

Returns
A random FP within [minInclusive , maxInclusive ]

◆ Next() [3/3]

Int32 Photon.Deterministic.RNGSession.Next ( Int32  minInclusive,
Int32  maxExclusive 
)
inline

Returns a random int within [minInclusive , maxExclusive ].

Returns
A random int within [minInclusive , maxExclusive ]

◆ NextInclusive() [3/3]

Int32 Photon.Deterministic.RNGSession.NextInclusive ( Int32  minInclusive,
Int32  maxInclusive 
)
inline

Returns a random int within [minInclusive , maxInclusive ].

Returns
A random int within [minInclusive , maxInclusive ]

◆ ToString()

override string Photon.Deterministic.RNGSession.ToString ( )
inline

Returns a string representation of the RNGSession.

◆ Serialize()

static void Photon.Deterministic.RNGSession.Serialize ( void *  ptr,
IDeterministicFrameSerializer  serializer 
)
inlinestatic

Serializes a RNGSession into a IDeterministicFrameSerializer to write or read from a frame snapshot.

Parameters
ptrThe pointer to the RNGSession.
serializerThe IDeterministicFrameSerializer instance into which the struct will be serialized.

◆ GetHashCode()

override int Photon.Deterministic.RNGSession.GetHashCode ( )
inline

Overrides the default hash function.

Returns
A hash code for the current object.

Member Data Documentation

◆ SIZE

const int Photon.Deterministic.RNGSession.SIZE = 16
static

The size of the struct in-memory inside the Frame data-buffers or stack (when passed as value parameter). Not related to the snapshot payload this occupies, which is bit-packed and compressed.

◆ MAX

const UInt32 Photon.Deterministic.RNGSession.MAX = UInt32.MaxValue
static

The maximum possible value to generate.

Property Documentation

◆ Peek

RNGSession Photon.Deterministic.RNGSession.Peek
get

Returns a copy of this RNGSession, can be used to check what next random values will be without affecting the state.