Ad
Log in to vote
0

I honestly have no idea, what does Random.new() do?

Asked by 9 months ago

I have no idea what the Random.new() constructor does. For me, all it did was return 'Random'.

1 answer

Log in to vote
2
Answered by 9 months ago
Edited 9 months ago

the constructor is a seed. Basically, the seed determines what the random number will be. for example, if you did Random:NextInteger(1,10) the random number that will be printed depends on the seed. If the seed was 58482, it might print 2. But if the seed was 948193, it could print 8.

its kind of like minecraft. if the seed was 94829184928, you could spawn in a snow biome. the seed dictates the number

so by creating a new Random, you pass a seed into the constructor that will give it its “randomness”

0
I tried entering random numbers but all it returned for me was 'Random'. deeskaalstickman649 388 — 9mo
Ad

Answer this question