WinterJamSnowman/Assets/Runtime/Extensions/RandomFromArray.cs

11 lines
280 B
C#
Raw Normal View History

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// Helper method for randomly rolling from a generic array
public static class RandomFromArray {
public static T GetRandom<T>(this T[] array) {
return array[Random.Range(0, array.Length)];
}
}