Space Engineers
Classes | Public Member Functions | Protected Member Functions | Properties | List of all members
VRage.Library.Utils.MyRandom Class Reference

Original C# implementation which allows settings the seed. More...

Classes

struct  State
 
struct  StateToken
 

Public Member Functions

 MyRandom ()
 
 MyRandom (int Seed)
 
StateToken PushSeed (int newSeed)
 
unsafe void GetState (out State state)
 
unsafe void SetState (ref State state)
 
int CreateRandomSeed ()
 
void SetSeed (int Seed)
 Sets new seed, only use this method when you have separate instance of MyRandom. Setting seed for RNG used for EntityId without reverting to previous state is dangerous. Use PushSeed for EntityId random generator. More...
 
int Next ()
 
int Next (int maxValue)
 
int Next (int minValue, int maxValue)
 
int Next (int hash, int minValue, int maxValue)
 
long NextLong ()
 
void NextBytes (byte[] buffer)
 
float NextFloat ()
 Returns random number between 0 and 1. More...
 
float NextFloat (int hash)
 Returns random number between 0 and 1. More...
 
double NextDouble ()
 Returns random number between 0 and 1. More...
 
double NextDouble (int hash)
 Returns random number between 0 and 1. More...
 

Protected Member Functions

double Sample ()
 
double Sample (int hash)
 

Properties

static MyRandom Instance [get]
 

Detailed Description

Original C# implementation which allows settings the seed.

Definition at line 13 of file MyRandom.cs.

Constructor & Destructor Documentation

VRage.Library.Utils.MyRandom.MyRandom ( )
inline

Definition at line 83 of file MyRandom.cs.

VRage.Library.Utils.MyRandom.MyRandom ( int  Seed)
inline

Definition at line 92 of file MyRandom.cs.

Member Function Documentation

int VRage.Library.Utils.MyRandom.CreateRandomSeed ( )
inline

Definition at line 153 of file MyRandom.cs.

unsafe void VRage.Library.Utils.MyRandom.GetState ( out State  state)
inline

Definition at line 117 of file MyRandom.cs.

int VRage.Library.Utils.MyRandom.Next ( )
inline

Definition at line 258 of file MyRandom.cs.

int VRage.Library.Utils.MyRandom.Next ( int  maxValue)
inline

Definition at line 263 of file MyRandom.cs.

int VRage.Library.Utils.MyRandom.Next ( int  minValue,
int  maxValue 
)
inline

Definition at line 272 of file MyRandom.cs.

int VRage.Library.Utils.MyRandom.Next ( int  hash,
int  minValue,
int  maxValue 
)
inline

Definition at line 286 of file MyRandom.cs.

void VRage.Library.Utils.MyRandom.NextBytes ( byte[]  buffer)
inline

Definition at line 306 of file MyRandom.cs.

double VRage.Library.Utils.MyRandom.NextDouble ( )
inline

Returns random number between 0 and 1.

Definition at line 331 of file MyRandom.cs.

double VRage.Library.Utils.MyRandom.NextDouble ( int  hash)
inline

Returns random number between 0 and 1.

Definition at line 337 of file MyRandom.cs.

float VRage.Library.Utils.MyRandom.NextFloat ( )
inline

Returns random number between 0 and 1.

Definition at line 319 of file MyRandom.cs.

float VRage.Library.Utils.MyRandom.NextFloat ( int  hash)
inline

Returns random number between 0 and 1.

Definition at line 325 of file MyRandom.cs.

long VRage.Library.Utils.MyRandom.NextLong ( )
inline

Definition at line 300 of file MyRandom.cs.

StateToken VRage.Library.Utils.MyRandom.PushSeed ( int  newSeed)
inline

Definition at line 112 of file MyRandom.cs.

double VRage.Library.Utils.MyRandom.Sample ( )
inlineprotected

Definition at line 342 of file MyRandom.cs.

double VRage.Library.Utils.MyRandom.Sample ( int  hash)
inlineprotected

Definition at line 347 of file MyRandom.cs.

void VRage.Library.Utils.MyRandom.SetSeed ( int  Seed)
inline

Sets new seed, only use this method when you have separate instance of MyRandom. Setting seed for RNG used for EntityId without reverting to previous state is dangerous. Use PushSeed for EntityId random generator.

Definition at line 163 of file MyRandom.cs.

unsafe void VRage.Library.Utils.MyRandom.SetState ( ref State  state)
inline

Definition at line 134 of file MyRandom.cs.

Property Documentation

MyRandom VRage.Library.Utils.MyRandom.Instance
staticget

Definition at line 60 of file MyRandom.cs.


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