diff options
Diffstat (limited to 'web/share/js/tools.js')
-rw-r--r-- | web/share/js/tools.js | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/web/share/js/tools.js b/web/share/js/tools.js index eec4be04..ef21b69f 100644 --- a/web/share/js/tools.js +++ b/web/share/js/tools.js @@ -70,6 +70,12 @@ export var tools = new function() { return btoa(text).replace("=", "_"); }; + self.getRandomInt = function(min, max) { + min = Math.ceil(min); + max = Math.floor(max); + return Math.floor(Math.random() * (max - min + 1)) + min; + }; + self.formatSize = function(size) { if (size > 0) { let index = Math.floor( Math.log(size) / Math.log(1024) ); |