I am trying to get random - numbers in-between 2 numbers.
COMMUNITY QUESTION
How to do math.random -numbers?
3 answers
math.random(lownumber, highnumber) will give you a random integer between the two given numbers. If the numbers are not given, it will generate a random decimal between 0 and 1.
print(math.random(1, 10))
print(math.random())
On a side note, you should have been able to find this on the wiki. Simply searching 'random numbers' would have given you what you need. Please do your research before coming here.
Sorry if I have misinterpreted however to get a minus you could do
x = math.random(1, 10)
y = x - (x*2)
This will make y a negative number in between -1 and -10
- == Negitive...
1 comment
0
It works the same with negatives, just make sure the smaller number is first, i.e. "print(math.random(-10,-1))"
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
the minus is == negitive