Enhance random with toNumber to allow binary and octal strings.

This commit is contained in:
Xotic750
2015-11-03 11:27:31 +01:00
committed by John-David Dalton
parent f45fc10cb1
commit 19e0650c4f

View File

@@ -11382,12 +11382,12 @@
max = 1; max = 1;
noMax = false; noMax = false;
} }
min = +min || 0; min = toNumber(min) || 0;
if (noMax) { if (noMax) {
max = min; max = min;
min = 0; min = 0;
} else { } else {
max = +max || 0; max = toNumber(max) || 0;
} }
if (floating || min % 1 || max % 1) { if (floating || min % 1 || max % 1) {
var rand = nativeRandom(); var rand = nativeRandom();