Show / Hide Table of Contents

Class RandomUtil

Inheritance
System.Object
RandomUtil
Namespace: Eco.Shared.Utils
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
Type Description
Vector2

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
Type Description
Vector2

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
Type Name Description
Vector2i pos
Returns
Type Description
Vector2i

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
Type Name Description
Vector2 vec
Returns
Type Description
System.Single

Range(Vector3i, Vector3i)

Declaration
public static Vector3i Range(Vector3i min, Vector3i max)
Parameters
Type Name Description
Vector3i min
Vector3i max
Returns
Type Description
Vector3i

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[])

Shortcut for Shuffle<T>(Random, T[]) with Global randomizer.

Declaration
public static void Shuffle<T>(T[] array)
Parameters
Type Name Description
T[] array
Type Parameters
Name Description
T

Vec2i(Int32)

Declaration
public static Vector2i Vec2i(int p)
Parameters
Type Name Description
System.Int32 p
Returns
Type Description
Vector2i
☀
☾
In This Article
Back to top
Copyright (c) Strange Loop Games 2021
☀
☾