This is the 11th video in this scripting series, and today we are covering Randomness in Roblox. I’m going to cover math.random and the Random DataType. A seed is a number used to initialize a pseudorandom number generator. Without some seed, the numbers produced may be easier to predict. Luckily Roblox staff members have produced an internal entropy, or randomness source. So both math.random, and the Random DataType use this source as a default seed. The NextInteger function can be used to get a random number between two values and including those values. Both the parameters are necessary for this to work. This will only produce integers or whole numbers. If you don’t want to be limited to whole numbers, then you can use the NextNumber function to produce any rational number. Without an argument, this function returns any number between 0 and 1, but not including 1. With an argument, this function returns any number between the first argument and the second argument, but not including the second argument. The reason why you might want to create multiple RNG’s and set a seed to a fixed number is so that you could create the same set of random numbers multiple times.
Join the Discord: / discord
Негізгі бет Roblox How to Script for Beginners | #11 | Random
Пікірлер: 16