Quad_mybb_import9988 Onyx user! Joined Oct 10, 2011 Posts 83 Reacts 0 Reputation 0 Credits 0 Nov 12, 2011 #1 Can someone tell me what's wrong with function, please? PHP: function rand(start, end) { return Math.floor((Math.random()*end-start)+start+1); }
Can someone tell me what's wrong with function, please? PHP: function rand(start, end) { return Math.floor((Math.random()*end-start)+start+1); }
eXore Member Joined Oct 11, 2011 Posts 407 Reacts 0 Reputation 0 Credits 0 Nov 12, 2011 #2 Math.floor((Math.random()*end-start)+start+1 It's wrong on that line. Spoiler
Quad_mybb_import9988 Onyx user! Joined Oct 10, 2011 Posts 83 Reacts 0 Reputation 0 Credits 0 Nov 12, 2011 #3 eXore said: Math.floor((Math.random()*end-start)+start+1 It's wrong on that line. Spoiler Click to expand... You means there's an error on that line? Oh, thanks, got it now.
eXore said: Math.floor((Math.random()*end-start)+start+1 It's wrong on that line. Spoiler Click to expand... You means there's an error on that line? Oh, thanks, got it now.
J4mmy Member Joined Nov 6, 2011 Posts 482 Reacts 0 Reputation 0 Credits 0 Nov 12, 2011 #4 function randomInRange(start, end) { return Math.round(start + Math.random() * (end - start)); }