So I have a math.random variable and it should print values between 0.5, 0.6, etc. but it only prints 0 and 1. Here's my code:
1 | local size = math.random( 0.5 , 1 ) |
2 | print (size) |
Edit: I figured it out. So apparently, math.random rounds numbers. So I just did math.random(5, 10) / 10, and that worked.
math.random only returns integers, if you want to have decimals then I suggest:
1 | local random = Random.new() |
2 | local random_integer = random:NextInteger( 1 , 10 ) |
3 | local random_number = random:NextNumber( 1 , 10 ) |
4 |
5 | print (random_integer) -- without decimals (6) |
6 | print (random_number) -- with decimals (6.1) |