From a67a36decb4d32dfb047f5f4fbcbb06209e3a573 Mon Sep 17 00:00:00 2001 From: sthag Date: Sat, 4 Apr 2026 09:59:43 +0200 Subject: [PATCH] fix: randomFloatFrom now correctly stays in range --- source/code/hippie/app.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/code/hippie/app.js b/source/code/hippie/app.js index 2b46f36..e9b5dd3 100644 --- a/source/code/hippie/app.js +++ b/source/code/hippie/app.js @@ -1,3 +1,5 @@ +/* jshint strict: false */ + // TODO: Inhalte angleichen nach Zusammenfassung von app.js und function.js. // Benennung und Beschreibungen verbessern. @@ -424,10 +426,10 @@ function randomIntFrom(min, max, pos = 0) { return Math.floor((Math.random() * (max - min + 1) + min) / pos) * pos; } -function randomFloatFrom(min, max, dec = 0) { +function randomFloatFrom(min, max, dec = 1) { dec = Math.pow(10, dec); - return Math.round((Math.random() * (max - min + 1) + min) * dec) / dec; + return Math.round((Math.random() * (max - min) + min) * dec) / dec; } /**