diff options
| author | RblSb <msrblsb@gmail.com> | 2020-02-24 07:58:56 +0300 |
|---|---|---|
| committer | RblSb <msrblsb@gmail.com> | 2020-02-24 07:58:56 +0300 |
| commit | 9c6cd2c2310d2e3ce3d1a6e3350a97e7ba0ca657 (patch) | |
| tree | 3eb12f0eee7ba05b7e70c740561eff31e06b608a /src/server/Utils.hx | |
| parent | c561fb9e2e42e4968f2b48cd535f208e90f8c12c (diff) | |
Start working on user folder
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); |
