unity-atoms/Source/Extensions/ArrayExtensions.cs
Jeff Campbell 7763f81ede Unified line endings
* Unified all line endings in project to align with .editorconfig; all end-of-line characters have been set to LF and new-lines placed at the end of every file if not present.
2019-04-07 11:56:54 +02:00

18 lines
354 B
C#

using UnityEngine;
namespace UnityAtoms.Extensions
{
public static class ArrayExtensions
{
public static T GetRandom<T>(this T[] array)
{
if (array == null || array.Length <= 0)
{
return default(T);
}
return array[Random.Range(0, array.Length)];
}
}
}