mirror of
https://github.com/MartinKral/Slash-The-Hordes
synced 2025-10-09 08:36:14 +00:00
Pauser, game modal launcher
This commit is contained in:
10
assets/Scripts/Services/Utils/ArrayUtils.ts
Normal file
10
assets/Scripts/Services/Utils/ArrayUtils.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
export function shuffle<T>(array: T[]): T[] {
|
||||
const shuffledArray: T[] = [...array];
|
||||
|
||||
for (let i = shuffledArray.length - 1; i > 0; i--) {
|
||||
const j = Math.floor(Math.random() * (i + 1));
|
||||
[shuffledArray[i], shuffledArray[j]] = [shuffledArray[j], shuffledArray[i]];
|
||||
}
|
||||
|
||||
return shuffledArray;
|
||||
}
|
9
assets/Scripts/Services/Utils/ArrayUtils.ts.meta
Normal file
9
assets/Scripts/Services/Utils/ArrayUtils.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "4cd531d9-5419-440d-880c-36ce0fe32955",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
Reference in New Issue
Block a user