Hey, so I’m aware of the new random class that was added recently, where you can create new instances of random, and use the methods upon it, like so:
local generator = Random.new()
print(generator:NextInteger(1, 2))
Does that mean math.random is deprecated or shouldn’t be used for new work? I sometimes use it for cases where I don’t want to create a new instance of it, so I just call random instead for simplicity.
math.random() completely works, however it is capped at the signed 32 bit integer limit (2.14Billion), which the new Random class isn’t. Random:NextInteger() is capped at the signed 64 bit integer limit (9.22 Quintillion). and Random:NextNumber() is capped at the float64 limit (1.8*(10^308)). So i suggest using Random:NextNumber() and then using math.round to round up the Number (since double values can store a lot of decimals and blow your head)