Created
March 16, 2015 17:27
-
-
Save bgadrian/6d38db99c51de6dd762b to your computer and use it in GitHub Desktop.
JS random numbers and chance generator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** random inclusive 2 integer positive numbers */ | |
function rdm(min,max) | |
{ | |
return (Math.floor(Math.random()*max+1)+min); | |
} | |
/** It has p % chances to result true ! p must be between 1 and 99 ! */ | |
function rdmp(p) | |
{ | |
return (rdm(0,100) <= p)?true:false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment