From 64728dc0e6831efa0aab766b832db650f7ec378c Mon Sep 17 00:00:00 2001 From: Maxim Devaev Date: Fri, 7 Jul 2023 14:03:44 +0300 Subject: pikvm/pikvm#1041: Randomized recorder events --- web/share/js/tools.js | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'web/share/js/tools.js') 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) ); -- cgit v1.2.3