Enfusion Script API
Loading...
Searching...
No Matches
RandomGenerator Interface Reference
Inheritance diagram for RandomGenerator:
Managed

Public Member Functions

proto external void SetSeed (int seed)
 
proto external vector GenerateRandomPoint (array< float > polygon, vector bbMin, vector bbMax)
 Generates random point in given polygon.
 
proto external vector GenerateRandomPointInRadius (float minRadius, float maxRadius, vector center, bool uniform=true)
 Generates a random point around center in range min/max radius.
 
proto external float RandFloat01 ()
 Generates random float in [0, 1] range.
 
proto external float RandFloatXY (float x, float y)
 Generates random float in [X, Y] range.
 
proto external float RandGaussFloat (float sigma, float mean)
 Returns random number with Gauss distribution (http://en.wikipedia.org/wiki/File:Normal_Distribution_PDF.svg)
 
proto external int RandInt (int min, int max)
 Returns a random int number between and min [inclusive] and max [exclusive].
 
proto external int RandIntInclusive (int min, int max)
 Returns a random int number between and min [inclusive] and max [inclusive].
 
- Public Member Functions inherited from Managed
proto external ref Managed Clone ()
 Return shallow copy of object, or null if it is not allowed (not public constructor)
 

Member Function Documentation

◆ GenerateRandomPoint()

proto external vector RandomGenerator.GenerateRandomPoint ( array< float > polygon,
vector bbMin,
vector bbMax )

Generates random point in given polygon.

Parameters
polygonConsecutive floats give polygon in 2D (2 floats = Vector2)
bbMinBounding box minimum corner
bbMaxBounding box maximum corner
Returns
Vector3 point in polygon

◆ GenerateRandomPointInRadius()

proto external vector RandomGenerator.GenerateRandomPointInRadius ( float minRadius,
float maxRadius,
vector center,
bool uniform = true )

Generates a random point around center in range min/max radius.

Parameters
minRadiusAll generated points will be at least this far from center
maxRadiusAll generated points will be at most this far from center
centerPosition around which to generate. Vector2 XZ
uniformIf false, has a small bias towards the center which may be desirable in some situations
Returns
Vector2 XZ set, Y = 0

◆ RandFloat01()

proto external float RandomGenerator.RandFloat01 ( )

Generates random float in [0, 1] range.

◆ RandFloatXY()

proto external float RandomGenerator.RandFloatXY ( float x,
float y )

Generates random float in [X, Y] range.

Parameters
xfloat Range starts[inclusive]
yfloat Range ends[inclusive]

◆ RandGaussFloat()

proto external float RandomGenerator.RandGaussFloat ( float sigma,
float mean )

Returns random number with Gauss distribution (http://en.wikipedia.org/wiki/File:Normal_Distribution_PDF.svg)

Parameters
mean
sigma

◆ RandInt()

proto external int RandomGenerator.RandInt ( int min,
int max )

Returns a random int number between and min [inclusive] and max [exclusive].

Parameters
minint Range starts [inclusive]
maxint Range ends [exclusive]
Returns
int - Random number in range
Print( gen.RandInt(0, 1) ); // only 0
Print( gen.RandInt(0, 2) ); // 0 or 1
>> 0
>> 1
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
Definition RandomGenerator.c:13
proto external int RandInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].

◆ RandIntInclusive()

proto external int RandomGenerator.RandIntInclusive ( int min,
int max )

Returns a random int number between and min [inclusive] and max [inclusive].

Parameters
minint Range starts [inclusive]
maxint Range ends [inclusive]
Returns
int - Random number in range
Print( gen.RandIntInclusive(0, 1) ); // 0 or 1
Print( gen.RandIntInclusive(0, 2) ); // 0, 1, 2
>> 1
>> 2
proto external int RandIntInclusive(int min, int max)
Returns a random int number between and min [inclusive] and max [inclusive].

◆ SetSeed()

proto external void RandomGenerator.SetSeed ( int seed)

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