I have the following code to generate two random numbers
var attackRoll = Math.floor((Math.random()*6)+1);
var defenceRoll = Math.floor((Math.random()*6)+1);
When I run this code, it will generate two random numbers as expected. The only thing I notice, I wish to just ask to make sure I am not going crazy is… The first variable will always have the higher “Roll” or “Equal I have run this code an output the values so many, many times and not once has the second value been higher than that of the first.
Is this just me being silly? Or have I assigned the random numbers incorrectly?
Do you mean that
attackRollis always greater than or equal thandefenceRoll? Absolutely not. In fact the probability of one being higher than the other is50%equal.Can you support your claims with a fiddle? Have you tried in different browser?