Quetzalcoatl.Langly said:
»Code
math.random() generates pseudo-random numbers uniformly distributed. Supplying argument alters its behaviour:
math.random() with no arguments generates a real number between 0 and 1.
math.random(upper) generates integer numbers between 1 and upper (both inclusive).
math.random(lower, upper) generates integer numbers between lower and upper (both inclusive).
> = math.random()
0.0012512588885159
> = math.random()
0.56358531449324
> = math.random(100)
20
> = math.random(100)
81
> = math.random(70,80)
76
> = math.random(70,80)
75
upper and lower must be integer. In other case Lua casts upper into an integer, sometimes giving math.floor(upper) and others math.ceil(upper), with unexpected results (the same for lower).
Thank you but this doesn't answer my questions.
I'm asking if an input of 1.0 is going to be taking as an integer and thereby output integer numbers (like in your example list) or if the function is realize its a real number and output a real number as well ( just like when there is no input for the function)
Examples
math.random(1.0,2.0)
is this only going to give me either 1 or 2 (aka intergers)
or does it realize those are real numbers and give me e.g 1.7?
I' trying to establish if I needs to add in a tiny fraction to force it to go to real numbers of it will understand from the simple presence of the dot.
nvm I misread the discription.
It will only give real numbers when no input is present