diff options
Diffstat (limited to 'src/server/Utils.hx')
| -rw-r--r-- | src/server/Utils.hx | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/server/Utils.hx b/src/server/Utils.hx index 2ecbd42..22ddc77 100644 --- a/src/server/Utils.hx +++ b/src/server/Utils.hx @@ -28,6 +28,17 @@ class Utils { return "127.0.0.1"; } + public static function sortedPush(ids:Array<Int>, id:Int):Void { + for (i in 0...ids.length) { + final n = ids[i]; + if (id < n) { + ids.insert(i, id); + return; + } + } + ids.push(id); + } + public static function shuffle<T>(arr:Array<T>):Void { for (i in 0...arr.length) { final n = Std.random(arr.length); |
