6 lines
No EOL
181 B
TypeScript
6 lines
No EOL
181 B
TypeScript
export class ArrayUtils {
|
|
public static chooseRandom<T>(array: Array<T>):T {
|
|
const index = Math.floor(Math.random() * array.length);
|
|
return array[index];
|
|
}
|
|
} |