• Announcement: Lua.org now officially recommends this forum as a meeting place for the Lua community

Random (1 Viewer)

Alienhead

Newcomer
Joined
Mar 29, 2022
Messages
5
Reaction score
0
Im trying to get a random number between a - negative and a positive. Math.Random(-10, 10) only seems to return positive.
 

Herly Quijano

Newcomer
Joined
Mar 19, 2021
Messages
83
Reaction score
10
I don't know what do you mean, because this:
Lua:
for i = 1, 10 do
    print(math.random(-10, 10))
end
printed me this:
Code:
-6
5
5
-7
6
-10
-10
-10
4
4
 

Alienhead

Newcomer
Joined
Mar 29, 2022
Messages
5
Reaction score
0
Thank you. Traced the problem back to my Editor font not having a - symbol in it.. lol go figure.
 
Top