getrandomarrayelementweighted - eisclimber/ExPresS-XR GitHub Wiki

RuntimeUtils.GetRandomArrayElementWeighted(T[],float[])

Method in RuntimeUtils

Summary

Returns a random element from an array using weighted distribution.

public static T GetRandomArrayElementWeighted<T>(T[] objects, float[] probabilities)

Parameters

Name Description
T[] objects Objects to draw from.
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** ⚠️