From 71bdd577e497de147f594bd1fb3071c55cb9732a Mon Sep 17 00:00:00 2001 From: michaeloffner Date: Tue, 10 Sep 2024 12:14:10 +0200 Subject: [PATCH] use Number instead of double for functions (will break things ;-) ) --- core/src/main/java/lucee/runtime/functions/math/RandRange.java | 2 +- test/functions/Cos.cfc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/lucee/runtime/functions/math/RandRange.java b/core/src/main/java/lucee/runtime/functions/math/RandRange.java index 0583645241..62cff5801c 100644 --- a/core/src/main/java/lucee/runtime/functions/math/RandRange.java +++ b/core/src/main/java/lucee/runtime/functions/math/RandRange.java @@ -40,7 +40,7 @@ public static Number call(PageContext pc, Number number1, Number number2, String max = tmp; } int diff = max - min; - return (Caster.toIntValue(Rand.call(pc, algo)) * (diff + 1)) + min; + return Caster.toIntValue((Rand.getRandom(algo, Double.NaN).nextDouble() * (diff + 1)) + min); } public static int invoke(int min, int max) throws ExpressionException { diff --git a/test/functions/Cos.cfc b/test/functions/Cos.cfc index 33d97fba57..cce97a56ce 100644 --- a/test/functions/Cos.cfc +++ b/test/functions/Cos.cfc @@ -2,7 +2,7 @@ component extends="org.lucee.cfml.test.LuceeTestCase"{ function run( testResults , testBox ) { describe( title="Test suite for Cos()", body=function() { it(title="checking Cos() function", body = function( currentSpec ) { - assertEquals("-0.9899924966004455","#tostring(cos(3))#"); + assertEquals("-0.989992496600","#left(tostring(cos(3)),15)#"); }); }); }