Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
Rand Class Reference

Static Public Member Functions

static void InitBytes (int a)
 
static void UseSeed (int seed, Action action)
 
static int rndSeed (int a, int seed)
 
static void SetSeed (int a=-1)
 
static int Range (int min, int max)
 
static float Range (float min, float max)
 
static int rnd (int max)
 
static float rndf (float max)
 
static int rndSqrt (int max)
 
static int rndNormal2 (int max)
 
static int rndNormal (int max)
 

Static Public Attributes

static int MaxBytes = 1111
 
static Random _random = new Random()
 
static byte[] bytes
 

Detailed Description

Definition at line 3 of file Rand.cs.

Member Function Documentation

◆ InitBytes()

static void Rand.InitBytes ( int  a)
inlinestatic

Definition at line 11 of file Rand.cs.

12 {
13 SetSeed(a);
14 bytes = new byte[MaxBytes];
15 for (int i = 0; i < MaxBytes; i++)
16 {
17 bytes[i] = (byte)_random.Next(256);
18 }
19 SetSeed();
20 }
static int MaxBytes
Definition: Rand.cs:5
static Random _random
Definition: Rand.cs:7
static byte[] bytes
Definition: Rand.cs:9
static void SetSeed(int a=-1)
Definition: Rand.cs:37

References _random, bytes, MaxBytes, and SetSeed().

Referenced by BaseTileMap.OnActivate().

◆ Range() [1/2]

static float Rand.Range ( float  min,
float  max 
)
inlinestatic

Definition at line 47 of file Rand.cs.

48 {
49 return (float)(_random.NextDouble() * (double)(max - min) + (double)min);
50 }

References _random.

◆ Range() [2/2]

◆ rnd()

◆ rndf()

static float Rand.rndf ( float  max)
inlinestatic

Definition at line 61 of file Rand.cs.

62 {
63 return Range(0f, max);
64 }

References Range.

Referenced by EClass.rndf().

◆ rndNormal()

static int Rand.rndNormal ( int  max)
inlinestatic

Definition at line 77 of file Rand.cs.

78 {
79 int num = max / 2;
80 return num + rnd(rnd(num) + 1) - rnd(rnd(num) + 1);
81 }
static int rnd(int max)
Definition: Rand.cs:52

References rnd().

Referenced by Biography.Generate().

◆ rndNormal2()

static int Rand.rndNormal2 ( int  max)
inlinestatic

Definition at line 71 of file Rand.cs.

72 {
73 int num = max / 2;
74 return num + rnd(rnd(rnd(num) + 1) + 1) - rnd(rnd(rnd(num) + 1) + 1);
75 }

References rnd().

◆ rndSeed()

static int Rand.rndSeed ( int  a,
int  seed 
)
inlinestatic

Definition at line 29 of file Rand.cs.

30 {
32 int result = rnd(a);
33 SetSeed();
34 return result;
35 }
@ seed

References rnd(), seed, and SetSeed().

Referenced by CalcMoney.BuySlave().

◆ rndSqrt()

static int Rand.rndSqrt ( int  max)
inlinestatic

Definition at line 66 of file Rand.cs.

67 {
68 return _random.Next(_random.Next(max) + 1);
69 }

References _random.

Referenced by EClass.rndSqrt().

◆ SetSeed()

◆ UseSeed()

static void Rand.UseSeed ( int  seed,
Action  action 
)
inlinestatic

Member Data Documentation

◆ _random

Random Rand._random = new Random()
static

Definition at line 7 of file Rand.cs.

Referenced by InitBytes(), Range(), rnd(), rndSqrt(), SetSeed(), and ClassExtension.Shuffle< TValue >().

◆ bytes

byte [] Rand.bytes
static

◆ MaxBytes

int Rand.MaxBytes = 1111
static

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