Skip to content
This repository was archived by the owner on Jul 17, 2020. It is now read-only.

Commit 0489146

Browse files
committed
fixed rand but when min or max is 0.
max should never be 0, but for consistency I updated both checks.
1 parent f44c624 commit 0489146

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

source/util.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,13 +229,13 @@ Math.gcd = function ( a, b ) {
229229

230230
Math.rand = function ( min, max ) {
231231
//rand() === rand( 0, 9 )
232-
if ( !min ) {
232+
if ( typeof min === 'undefined' ) {
233233
min = 0;
234234
max = 9;
235235
}
236236

237237
//rand( max ) === rand( 0, max )
238-
else if ( !max ) {
238+
else if ( typeof max === 'undefined' ) {
239239
max = min;
240240
min = 0;
241241
}

0 commit comments

Comments
 (0)