Photon Fusion 1.1.12

Public Member Functions | Static Public Attributes | Properties | List of all members
NetworkRNG Struct Reference

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

Inherits INetworkStruct.

Public Member Functions

 NetworkRNG (Int32 seed)
 
double Next ()
 Returns a random Double within [0, 1] (range is inclusive). More...
 
double NextExclusive ()
 Returns a random Double within [0, 1) (range is exclusive). More...
 
int NextInt32 ()
 [int.MinValue, int.MaxValue] More...
 
float NextSingle ()
 Returns a random Single within [0, 1] (range is inclusive). More...
 
float NextSingleExclusive ()
 [0, 1) Returns a random Single within [0, 1) (range is exclusive). More...
 
uint NextUInt32 ()
 [0, uint.MaxValue] More...
 
Int32 RangeExclusive (Int32 minInclusive, Int32 maxExclusive)
 Returns a random Int32 within [minInclusive, maxExclusive) (range is exclusive). If minInclusive and maxExclusive are equal, then the "exclusive rule" is ignored and minInclusive will be returned. If minInclusive is greater than maxExclusive, then the numbers are automatically swapped. More...
 
UInt32 RangeExclusive (UInt32 minInclusive, UInt32 maxExclusive)
 Returns a random UInt32 within [minInclusive, maxExclusive) (range is exclusive). If minInclusive and maxExclusive are equal, then the "exclusive rule" is ignored and minInclusive will be returned. If minInclusive is greater than maxExclusive, then the numbers are automatically swapped. More...
 
Double RangeInclusive (Double minInclusive, Double maxInclusive)
 Returns a random Double within [minInclusive, maxInclusive] (range is inclusive). If minInclusive is greater than maxInclusive, then the numbers are automatically swapped. More...
 
Int32 RangeInclusive (Int32 minInclusive, Int32 maxInclusive)
 Returns a random Int32 within [minInclusive, maxInclusive] (range is inclusive). If minInclusive is greater than maxInclusive, then the numbers are automatically swapped. More...
 
Single RangeInclusive (Single minInclusive, Single maxInclusive)
 Returns a random Single within [minInclusive, maxInclusive] (range is inclusive). If minInclusive is greater than maxInclusive, then the numbers are automatically swapped. More...
 
UInt32 RangeInclusive (UInt32 minInclusive, UInt32 maxInclusive)
 Returns a random UInt32 within [minInclusive, maxInclusive] (range is inclusive). If minInclusive is greater than maxInclusive, then the numbers are automatically swapped. More...
 
override string ToString ()
 

Static Public Attributes

const UInt32 MAX = UInt32.MaxValue
 
const int SIZE = 16
 

Properties

NetworkRNG Peek [get]
 

Detailed Description

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

Member Function Documentation

◆ Next()

double Next ( )

Returns a random Double within [0, 1] (range is inclusive).

Returns

◆ NextExclusive()

double NextExclusive ( )

Returns a random Double within [0, 1) (range is exclusive).

Returns

◆ NextInt32()

int NextInt32 ( )

[int.MinValue, int.MaxValue]

Returns

◆ NextSingle()

float NextSingle ( )

Returns a random Single within [0, 1] (range is inclusive).

Returns

◆ NextSingleExclusive()

float NextSingleExclusive ( )

[0, 1) Returns a random Single within [0, 1) (range is exclusive).

Returns

◆ NextUInt32()

uint NextUInt32 ( )

[0, uint.MaxValue]

Returns

◆ RangeExclusive() [1/2]

Int32 RangeExclusive ( Int32  minInclusive,
Int32  maxExclusive 
)

Returns a random Int32 within [minInclusive, maxExclusive) (range is exclusive). If minInclusive and maxExclusive are equal, then the "exclusive rule" is ignored and minInclusive will be returned. If minInclusive is greater than maxExclusive, then the numbers are automatically swapped.

◆ RangeExclusive() [2/2]

UInt32 RangeExclusive ( UInt32  minInclusive,
UInt32  maxExclusive 
)

Returns a random UInt32 within [minInclusive, maxExclusive) (range is exclusive). If minInclusive and maxExclusive are equal, then the "exclusive rule" is ignored and minInclusive will be returned. If minInclusive is greater than maxExclusive, then the numbers are automatically swapped.

◆ RangeInclusive() [1/4]

Double RangeInclusive ( Double  minInclusive,
Double  maxInclusive 
)

Returns a random Double within [minInclusive, maxInclusive] (range is inclusive). If minInclusive is greater than maxInclusive, then the numbers are automatically swapped.

◆ RangeInclusive() [2/4]

Int32 RangeInclusive ( Int32  minInclusive,
Int32  maxInclusive 
)

Returns a random Int32 within [minInclusive, maxInclusive] (range is inclusive). If minInclusive is greater than maxInclusive, then the numbers are automatically swapped.

◆ RangeInclusive() [3/4]

Single RangeInclusive ( Single  minInclusive,
Single  maxInclusive 
)

Returns a random Single within [minInclusive, maxInclusive] (range is inclusive). If minInclusive is greater than maxInclusive, then the numbers are automatically swapped.

◆ RangeInclusive() [4/4]

UInt32 RangeInclusive ( UInt32  minInclusive,
UInt32  maxInclusive 
)

Returns a random UInt32 within [minInclusive, maxInclusive] (range is inclusive). If minInclusive is greater than maxInclusive, then the numbers are automatically swapped.