Okay this may be a stupid question but is there a 3rd argument to math.random Like for example:
math.random(1,10,2) -- just an example
If so please tell me what the 3rd argument does, thanks! I thought I saw someone use a 3rd number but I'm not for sure so I just wanted to know!
I think you must've mistaken the three Arguments from a Vector3 method, because the math.random method has two arguments math.random(Argument1,Argument2)
, or optionally, you can use just one argument to it math.random(Argument)
, what math.random
does is, choose a number between the Two arguments, unless if you only have one argument, then it'll choose a number from Zero-Number, you could also leave it with no Arguments, and that will choose a random number between Zero-One 'I'm guessing', heres an Example of what I mean;
print(math.random(5,15)) --This will choose a random number between '5' and '15' print(math.random(5)) --This will choose a random number between '0' and '5' print(math.random()) --This will choose a random number between '0' and '1', looking some-what like this '0.41923276467177'
math.random
has no third argument, sadly, and if you tried you'd get an error like this; Wrong number of arguments
, but don't worry, we all make mistakes!
Hope this helped!
The only way to find out about that is to test it on your place.
Otherwise, according to wiki, there are only two arguments.
:l
EDIT
I noticed I was being rather very half-hearted and I am truly sorry for my undoubtedly unspecific answer.
Anyways, there is no third argument in the mathematical function 'math.random()', as it only has two parameters and takes up to two arguments.
"Up to," meaning I can have 0, 1, or 2 arguments within the parameters.
Just as what TheAlphaStigma said...
If there are 0 arguments filled in, Roblox assumes that the arguments are (0,1) (meaning the function will pick a random number from 0 to 1).
If there is 1 argument filled in, Roblox assumes that that argument is the final number and that 0 is the starting number.
If there are 2 arguments filled in, Roblox will utilize those numbers as the range between them.
Of course, the initial and final numbers are included in the range of numbers that the function picks from.
Locked by TheMyrco
This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.
Why was this question closed?