SystemEX  Lacking
Additional generic collection types missing in .net
SystemEx.Random.Randx Class Referencesealed

Provides a simple interface for generating random numbers using the ISAAC algorithm. More...

Public Member Functions

 Randx (uint seedA=0, uint seedB=0, uint seedC=0)
 Initializes a new instance of the Randx class with the specified.
uint Next32 ()
 Generates the next random 32-bit number in the sequence.
ulong Next64 ()
 Generates the next random 64-bit number in the sequence.
byte NextByte ()
 Generates the next random byte in the sequence.
void NextBytes (byte[] buffer)
 Generates the next random number in the specified range.
uint Next (uint min, uint max)
 Generates the next random number in the specified range.
ulong Next (ulong min, ulong max)
 Generates the next random number in the specified range.
char NextChar ()
 Generates the next random character in the sequence.
string NextString (int length)
 Generates the next random string in the sequence.
uint NextHashSeed32 ()
 Generates the next random hash seed in the sequence.
ulong NextHashSeed64 ()
 Generates the next random hash seed in the sequence.

Detailed Description

Provides a simple interface for generating random numbers using the ISAAC algorithm.

Constructor & Destructor Documentation

◆ Randx()

SystemEx.Random.Randx.Randx ( uint seedA = 0,
uint seedB = 0,
uint seedC = 0 )

Initializes a new instance of the Randx class with the specified.

Parameters
seedAThe first seed value.
seedBThe second seed value.
seedCThe third seed value.
33 {
34 _core = new Isaac32Engine(seedA, seedB, seedC);
35 }

Member Function Documentation

◆ Next() [1/2]

uint SystemEx.Random.Randx.Next ( uint min,
uint max )

Generates the next random number in the specified range.

Parameters
minThe minimum value.
maxThe maximum value.
Returns
The next random number.
74 {
75 uint r = Next32();
76 return min + (r % (max - min));
77 }
Here is the call graph for this function:

◆ Next() [2/2]

ulong SystemEx.Random.Randx.Next ( ulong min,
ulong max )

Generates the next random number in the specified range.

Parameters
minThe minimum value.
maxThe maximum value.
Returns
The next random number.
84 {
85 ulong r = Next64();
86 return min + (r % (max - min));
87 }
Here is the call graph for this function:

◆ Next32()

uint SystemEx.Random.Randx.Next32 ( )

Generates the next random 32-bit number in the sequence.

Returns
The next random 32-bit number.
40 {
41 return _core.Next();
42 }
Here is the caller graph for this function:

◆ Next64()

ulong SystemEx.Random.Randx.Next64 ( )

Generates the next random 64-bit number in the sequence.

Returns
The next random 64-bit number.
47 {
48 // Zwei ISAAC‑Werte kombinieren → stabil, deterministisch
49 ulong hi = _core.Next();
50 ulong lo = _core.Next();
51 return (hi << 32) | lo;
52 }
Here is the caller graph for this function:

◆ NextByte()

byte SystemEx.Random.Randx.NextByte ( )

Generates the next random byte in the sequence.

Returns
The next random byte.
57 {
58 return (byte)(_core.Next() & 0xFF);
59 }
Here is the caller graph for this function:

◆ NextBytes()

void SystemEx.Random.Randx.NextBytes ( byte[] buffer)

Generates the next random number in the specified range.

Parameters
bufferThe buffer to fill with random bytes.
64 {
65 for ( int i = 0 ; i < buffer.Length ; i++ )
66 buffer[i] = NextByte();
67 }
Here is the call graph for this function:

◆ NextChar()

char SystemEx.Random.Randx.NextChar ( )

Generates the next random character in the sequence.

Returns
The next random character.
92 {
93 return (char)(Next32() & 0xFF);
94 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ NextHashSeed32()

uint SystemEx.Random.Randx.NextHashSeed32 ( )

Generates the next random hash seed in the sequence.

Returns
The next random hash seed.
110 {
111 return Next32();
112 }
Here is the call graph for this function:

◆ NextHashSeed64()

ulong SystemEx.Random.Randx.NextHashSeed64 ( )

Generates the next random hash seed in the sequence.

Returns
The next random hash seed.
117 {
118 return Next64();
119 }
Here is the call graph for this function:

◆ NextString()

string SystemEx.Random.Randx.NextString ( int length)

Generates the next random string in the sequence.

Parameters
lengthThe length of the string to generate.
Returns
The next random string.
100 {
101 char[] c = new char[length];
102 for ( int i = 0 ; i < length ; i++ )
103 c[i] = NextChar();
104 return new string(c);
105 }
Here is the call graph for this function:

The documentation for this class was generated from the following file:
  • Randx.cs