Skip to content

RandomUtility

Namespace: SideXP.Core

public static class RandomUtility

Utility functions for random behaviors.

Methods

RandomAmong(object[])

public static object RandomAmong(params object[] values)

Gets a random value among the given ones.

Parameters

  • values: The values that can be picked at random.

Returns

Returns the randomly picked value, or null if no value is provided.

RandomAmong<T>(T[])

public static T RandomAmong<T>(params T[] values)

Gets a random value among the given ones.

Type parameters

  • T: The type of the values to pick at random.

Parameters

  • values: The values that can be picked at random.

Returns

Returns the randomly picked value, or the default value of T if no value is provided.