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

A basic implementation of a random number generator More...

Inheritance diagram for pluginbase.Helpers.Computative.Random.PseudoRandom:
pluginbase.Helpers.Computative.Random.IPseudoRandom

Public Member Functions

 PseudoRandom (int seed)
 Instantiates a new instance with a given seed More...
 
float Rand (int val)
 Returns float 0.0 - 1.0 More...
 

Public Attributes

readonly int Seed
 The seed for this instance of the random generator More...
 

Detailed Description

A basic implementation of a random number generator

Constructor & Destructor Documentation

pluginbase.Helpers.Computative.Random.PseudoRandom.PseudoRandom ( int  seed)

Instantiates a new instance with a given seed

Parameters
seedSeed.
19  {
20  Seed = seed;
21  }
readonly int Seed
The seed for this instance of the random generator
Definition: PseudoRandom.cs:12

Member Function Documentation

float pluginbase.Helpers.Computative.Random.PseudoRandom.Rand ( int  val)

Returns float 0.0 - 1.0

Parameters
valA System.Int32
Returns
A System.Single

Implements pluginbase.Helpers.Computative.Random.IPseudoRandom.

33  {
34  unchecked{
35  val = val << 13 ^ val;
36  return (float)(( (val * (val * val * 15731 + 789221) + 1376312589 + Seed*3948906456) & 0x7fffffff) / 1073741824.0 * 0.5);
37  }
38  }
readonly int Seed
The seed for this instance of the random generator
Definition: PseudoRandom.cs:12

Member Data Documentation

readonly int pluginbase.Helpers.Computative.Random.PseudoRandom.Seed

The seed for this instance of the random generator


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