Show / Hide Table of Contents

Class MyRandom

Original C# implementation which allows settings the seed.

Inheritance
System.Object
MyRandom
Namespace: VRage.Library.Utils
Assembly: VRage.Library.dll
Syntax
public class MyRandom : Object

Constructors

MyRandom()

Declaration
public MyRandom()

MyRandom(Int32)

Declaration
public MyRandom(int Seed)
Parameters
Type Name Description
System.Int32 Seed

Properties

Instance

Declaration
public static MyRandom Instance { get; }
Property Value
Type Description
MyRandom

Methods

CreateRandomSeed()

Declaration
public int CreateRandomSeed()
Returns
Type Description
System.Int32

GetRandomFloat(Single, Single)

Declaration
public float GetRandomFloat(float minValue, float maxValue)
Parameters
Type Name Description
System.Single minValue
System.Single maxValue
Returns
Type Description
System.Single

GetRandomSign()

Declaration
public float GetRandomSign()
Returns
Type Description
System.Single

GetState(out MyRandom.State)

Declaration
public void GetState(out MyRandom.State state)
Parameters
Type Name Description
MyRandom.State state

Next()

Declaration
public int Next()
Returns
Type Description
System.Int32

Next(Int32)

Declaration
public int Next(int maxValue)
Parameters
Type Name Description
System.Int32 maxValue
Returns
Type Description
System.Int32

Next(Int32, Int32)

Declaration
public int Next(int minValue, int maxValue)
Parameters
Type Name Description
System.Int32 minValue
System.Int32 maxValue
Returns
Type Description
System.Int32

NextBytes(Byte[])

Declaration
public void NextBytes(byte[] buffer)
Parameters
Type Name Description
System.Byte[] buffer

NextDouble()

Declaration
public double NextDouble()
Returns
Type Description
System.Double

NextFloat()

Declaration
public float NextFloat()
Returns
Type Description
System.Single

NextLong()

Declaration
public long NextLong()
Returns
Type Description
System.Int64

PushSeed(Int32)

Declaration
public MyRandom.StateToken PushSeed(int newSeed)
Parameters
Type Name Description
System.Int32 newSeed
Returns
Type Description
MyRandom.StateToken

Sample()

Declaration
protected double Sample()
Returns
Type Description
System.Double

SetSeed(Int32)

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.

Declaration
public void SetSeed(int Seed)
Parameters
Type Name Description
System.Int32 Seed

SetState(ref MyRandom.State)

Declaration
public void SetState(ref MyRandom.State state)
Parameters
Type Name Description
MyRandom.State state
☀
☾
In This Article
Back to top
Generated by DocFX
☀
☾