diff options
author | Maxim Devaev <[email protected]> | 2023-07-07 14:03:44 +0300 |
---|---|---|
committer | Maxim Devaev <[email protected]> | 2023-07-07 17:30:58 +0300 |
commit | 64728dc0e6831efa0aab766b832db650f7ec378c (patch) | |
tree | af7504633ca62785f47bfe12713ec1f21027576f /web/share/js/tools.js | |
parent | 26d807a4b9304521a901ad8ec0548d167d13a37d (diff) |
pikvm/pikvm#1041: Randomized recorder events
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) ); |