Archived
Private
Public Access
1
0
This repository has been archived on 2026-02-04. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
ProjectBackup/C#/FiveM/TaxiJob/TaxiJob.Shared/ArrayExtensions.cs
2022-12-07 15:35:41 +01:00

17 lines
503 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
namespace TaxiJob.Shared {
public static class ArrayExtensions {
public static T Random<T>(this IEnumerable<T> enumerable, [Optional] int seed) {
var random = new Random(seed != 0 ? seed : Environment.TickCount);
var array = enumerable.ToArray();
var index = random.Next(array.Length);
return array[index];
}
}
}