Empeld
Empeld plugin documentation.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events
pluginbase.Helpers.Computative.Rand Class Reference

Convenience methods for random number generation More...

Static Public Member Functions

static float Float ()
 Generate a random float between 0 inclusive and 1 exclusive More...
 
static float Float (float max)
 Generate a random float between 0 inclusive and max exclusive More...
 
static float Float (float min, float max)
 Generate a random float between min inclusive and max exclusive More...
 
static double Double ()
 Generate a random double between 0 inclusive and 1 exclusive More...
 
static double Double (double max)
 Generate a double between 0 inclusive and max exclusive More...
 
static double Double (double min, double max)
 Generate a double between min inclusive and max exclusive More...
 
static int Int ()
 Returns a random integer More...
 
static int Int (int max)
 Returns a random integer less than max More...
 
static int Int (int min, int max)
 Returns a random integer greater than min and less than max More...
 
static double Unitd ()
 Returns a random double between 0.0 inclusive, and 1.0 exclusive More...
 
static float Unitf ()
 Return a random float between 0.0 inclusive, and 1.0 exclusive More...
 
static double Dird ()
 Return a double between -1 and 1 More...
 
static float Dirf ()
 Return a float between -1 and 1 More...
 
static Vector3d Dir3d ()
 Return a normalized random vector More...
 
static Vector3d Dirz3d ()
 Return a normalized vector masked with (1,1,0) More...
 
static Vector3 Dir3f ()
 Return a normalized random vector More...
 
static Vector3 Dirz3f ()
 Return a normal vector masked with (1,1,0) More...
 
static bool Chance (double likelihood)
 Returns true if a random number falls below a likelihood More...
 

Detailed Description

Convenience methods for random number generation

Member Function Documentation

static bool pluginbase.Helpers.Computative.Rand.Chance ( double  likelihood)
static

Returns true if a random number falls below a likelihood

Parameters
likelihoodLikelihood.
169  {
170  return RandGen.NextDouble() < likelihood;
171  }
static Vector3d pluginbase.Helpers.Computative.Rand.Dir3d ( )
static

Return a normalized random vector

136  {
137  return new Vector3d(Dird(), Dird(), Dird()).Normalized();
138  }
static double Dird()
Return a double between -1 and 1
Definition: Rand.cs:119
static Vector3 pluginbase.Helpers.Computative.Rand.Dir3f ( )
static

Return a normalized random vector

152  {
153  return new Vector3(Dirf(), Dirf(), Dirf()).Normalized();
154  }
static float Dirf()
Return a float between -1 and 1
Definition: Rand.cs:127
static double pluginbase.Helpers.Computative.Rand.Dird ( )
static

Return a double between -1 and 1

120  {
121  return RandGen.NextDouble() * 2.0 - 1.0;
122  }
static float pluginbase.Helpers.Computative.Rand.Dirf ( )
static

Return a float between -1 and 1

128  {
129  return (float)RandGen.NextDouble() * 2f - 1f;
130  }
static Vector3d pluginbase.Helpers.Computative.Rand.Dirz3d ( )
static

Return a normalized vector masked with (1,1,0)

144  {
145  return new Vector3d(Dird(), Dird(), 0.0).Normalized();
146  }
static double Dird()
Return a double between -1 and 1
Definition: Rand.cs:119
static Vector3 pluginbase.Helpers.Computative.Rand.Dirz3f ( )
static

Return a normal vector masked with (1,1,0)

160  {
161  return new Vector3(Dirf(), Dirf(), 0f).Normalized();
162  }
static float Dirf()
Return a float between -1 and 1
Definition: Rand.cs:127
static double pluginbase.Helpers.Computative.Rand.Double ( )
static

Generate a random double between 0 inclusive and 1 exclusive

50  {
51  return RandGen.NextDouble();
52  }
static double pluginbase.Helpers.Computative.Rand.Double ( double  max)
static

Generate a double between 0 inclusive and max exclusive

Parameters
maxMax.
59  {
60  return RandGen.NextDouble() * max;
61  }
static double pluginbase.Helpers.Computative.Rand.Double ( double  min,
double  max 
)
static

Generate a double between min inclusive and max exclusive

Parameters
minMinimum.
maxMax.
69  {
70  return RandGen.NextDouble() * (max - min) + min;
71  }
static float pluginbase.Helpers.Computative.Rand.Float ( )
static

Generate a random float between 0 inclusive and 1 exclusive

23  {
24  return (float)RandGen.NextDouble();
25  }
static float pluginbase.Helpers.Computative.Rand.Float ( float  max)
static

Generate a random float between 0 inclusive and max exclusive

Parameters
maxMax.
32  {
33  return (float)RandGen.NextDouble() * max;
34  }
static float pluginbase.Helpers.Computative.Rand.Float ( float  min,
float  max 
)
static

Generate a random float between min inclusive and max exclusive

Parameters
minMinimum.
maxMax.
42  {
43  return (float)RandGen.NextDouble() * (max - min) + min;
44  }
static int pluginbase.Helpers.Computative.Rand.Int ( )
static

Returns a random integer

77  {
78  return RandGen.Next();
79  }
static int pluginbase.Helpers.Computative.Rand.Int ( int  max)
static

Returns a random integer less than max

Parameters
maxThe exclusive max value.
86  {
87  return RandGen.Next(max);
88  }
static int pluginbase.Helpers.Computative.Rand.Int ( int  min,
int  max 
)
static

Returns a random integer greater than min and less than max

Parameters
minInclusive minimum.
maxExclusive max.
96  {
97  return RandGen.Next(min, max);
98  }
static double pluginbase.Helpers.Computative.Rand.Unitd ( )
static

Returns a random double between 0.0 inclusive, and 1.0 exclusive

104  {
105  return RandGen.NextDouble();
106  }
static float pluginbase.Helpers.Computative.Rand.Unitf ( )
static

Return a random float between 0.0 inclusive, and 1.0 exclusive

112  {
113  return (float)RandGen.NextDouble();
114  }

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