Seriously, I’ve read the wiki and I still don’t know how to use it. Anyone can help me out?
Random.new()
creates a generator. To use it, use its assigned variable’s functions like RandomObject:NextInteger()
, for instance.
2 Likes
Like this?
local gen = Random.new()
gen:NextInteger()
Yes, that’s exactly how it is supposed to be used. If you print the second line, you’ll get a random number based on the number you put as the first argument.
Okay, so I heard that this is better than math.random()
?
Sounded like a micro-optimization. It’s the same algorithm and does not alter performance too drastically.
Not exactly sure what they do, but you can probably try to print them. I think they will include decimals, unlike integers. Integers will never include decimals.
Right, thanks for the support.
1 Like