mirror of
https://github.com/NotXia/notxia.github.io.git
synced 2025-12-14 10:51:52 +01:00
11 lines
317 B
TypeScript
11 lines
317 B
TypeScript
export function randomOfArray<T>(array:T[]):T {
|
|
return array[Math.floor(Math.random() * array.length)];
|
|
}
|
|
|
|
export function random(min:number, max:number):number {
|
|
return Math.random() * (max - min) + min;
|
|
}
|
|
|
|
export function randomInt(min:number, max:number):number {
|
|
return Math.floor(random(min, max));
|
|
} |