Provides a simple interface for generating random numbers using the ISAAC algorithm.
More...
|
| | 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.
|
Provides a simple interface for generating random numbers using the ISAAC algorithm.
◆ 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
-
| seedA | The first seed value. |
| seedB | The second seed value. |
| seedC | The third seed value. |
33 {
34 _core = new Isaac32Engine(seedA, seedB, seedC);
35 }
◆ Next() [1/2]
| uint SystemEx.Random.Randx.Next |
( |
uint | min, |
|
|
uint | max ) |
Generates the next random number in the specified range.
- Parameters
-
| min | The minimum value. |
| max | The maximum value. |
- Returns
- The next random number.
74 {
75 uint r = Next32();
76 return min + (r % (max - min));
77 }
◆ Next() [2/2]
| ulong SystemEx.Random.Randx.Next |
( |
ulong | min, |
|
|
ulong | max ) |
Generates the next random number in the specified range.
- Parameters
-
| min | The minimum value. |
| max | The maximum value. |
- Returns
- The next random number.
84 {
85 ulong r = Next64();
86 return min + (r % (max - min));
87 }
◆ 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 }
◆ 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
49 ulong hi = _core.Next();
50 ulong lo = _core.Next();
51 return (hi << 32) | lo;
52 }
◆ 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 }
◆ NextBytes()
| void SystemEx.Random.Randx.NextBytes |
( |
byte[] | buffer | ) |
|
Generates the next random number in the specified range.
- Parameters
-
| buffer | The buffer to fill with random bytes. |
64 {
65 for ( int i = 0 ; i < buffer.Length ; i++ )
66 buffer[i] = NextByte();
67 }
◆ 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 }
◆ 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 }
◆ 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 }
◆ NextString()
| string SystemEx.Random.Randx.NextString |
( |
int | length | ) |
|
Generates the next random string in the sequence.
- Parameters
-
| length | The 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 }
The documentation for this class was generated from the following file: