Class RandomUtil
Inheritance
System.Object
RandomUtil
Assembly: Eco.Shared.dll
Syntax
public static class RandomUtil : Object
Properties
Global
Declaration
public static Random Global { get; }
Property Value
Type |
Description |
System.Random |
|
InsideUnitCircle
Declaration
public static Vector2 InsideUnitCircle { get; }
Property Value
IntValue
Declaration
public static int IntValue { get; }
Property Value
Type |
Description |
System.Int32 |
|
Value
Declaration
public static float Value { get; }
Property Value
Type |
Description |
System.Single |
|
Vec2
Declaration
public static Vector2 Vec2 { get; }
Property Value
Vec3
Declaration
public static Vector3 Vec3 { get; }
Property Value
Type |
Description |
System.Numerics.Vector3 |
|
Methods
Chance(Single)
Returns true or false based on random chance.
Declaration
public static bool Chance(float p)
Parameters
Type |
Name |
Description |
System.Single |
p |
Value in range [0,1] determining chance of true being returned, where 0 means no chance and 1 means true will always be returned.
|
Returns
Type |
Description |
System.Boolean |
|
CoinToss()
Declaration
public static bool CoinToss()
Returns
Type |
Description |
System.Boolean |
|
Next(Int32)
Declaration
public static int Next(int maxValue)
Parameters
Type |
Name |
Description |
System.Int32 |
maxValue |
|
Returns
Type |
Description |
System.Int32 |
|
Random(Vector2i)
Declaration
public static Vector2i Random(this Vector2i pos)
Parameters
Returns
RandomBytes(Int32)
Return an array of random bytes of the given length
Declaration
public static byte[] RandomBytes(int len)
Parameters
Type |
Name |
Description |
System.Int32 |
len |
|
Returns
Type |
Description |
System.Byte[] |
|
Range(Vector2)
Declaration
public static float Range(Vector2 vec)
Parameters
Returns
Type |
Description |
System.Single |
|
Range(Vector3i, Vector3i)
Declaration
public static Vector3i Range(Vector3i min, Vector3i max)
Parameters
Returns
Range(Double, Double)
Declaration
public static double Range(double x, double y)
Parameters
Type |
Name |
Description |
System.Double |
x |
|
System.Double |
y |
|
Returns
Type |
Description |
System.Double |
|
Range(Int32, Int32)
Declaration
public static int Range(int x, int y)
Parameters
Type |
Name |
Description |
System.Int32 |
x |
|
System.Int32 |
y |
|
Returns
Type |
Description |
System.Int32 |
|
Range(Random, Single, Single)
Declaration
public static float Range(this Random random, float x, float y)
Parameters
Type |
Name |
Description |
System.Random |
random |
|
System.Single |
x |
|
System.Single |
y |
|
Returns
Type |
Description |
System.Single |
|
Range(Single, Single)
Declaration
public static float Range(float x, float y)
Parameters
Type |
Name |
Description |
System.Single |
x |
|
System.Single |
y |
|
Returns
Type |
Description |
System.Single |
|
Shuffle<T>(T[])
Declaration
public static void Shuffle<T>(T[] array)
Parameters
Type |
Name |
Description |
T[] |
array |
|
Type Parameters
Vec2i(Int32)
Declaration
public static Vector2i Vec2i(int p)
Parameters
Type |
Name |
Description |
System.Int32 |
p |
|
Returns