getrandomarrayelement 2 - eisclimber/ExPresS-XR GitHub Wiki

RuntimeUtils.GetRandomArrayElement(T[],bool,float[])

Method in RuntimeUtils

Summary

Return a random element from the first array given the probabilities for each object. If a linear or weighted distribution should be used, is decided by the useWeighted value.

public static T GetRandomArrayElement<T>(T[] objects, bool useWeighted, float[] probabilities = null)

Parameters

Name Description
T[] objects Objects to draw from.
bool useWeighted Whether or not weighted random should be used.
float[] probabilities Probabilities for each object.

Type Parameters

Name Description
T Type of the object to draw.

Returns

A random object from the array.

⚠️ **GitHub.com Fallback** ⚠️