Hi there, (dang haven’t posted in ages)
I’m trying to make a quick weather system using clouds density and cover. But when I do that:
This happens.
Any help please? This is my first time using math.random.
Thanks, Aki
Hi there, (dang haven’t posted in ages)
I’m trying to make a quick weather system using clouds density and cover. But when I do that:
This happens.
Any help please? This is my first time using math.random.
Thanks, Aki
If you are using math.random and for generating between 0 to 1 you can just use
local cover = math.random() --Generate between [0 to 1), doesn't fully reach 1, close enough like 0.9999
From documentation.
When called without arguments, returns a uniform pseudo-random real number in the range [0,1). When called with an integer number m, math.random returns a uniform pseudo-random integer in the range [1, m]. When called with two integer numbers m and n, math.random returns a uniform pseudo-random integer in the range [m, n].
To modify it you can use multiplication to modify the range
local newRange = math.random()*100 --generate [0,1), then multiplies by 100 [0*100,1*100) = [0, 100)
If you do dislike this method you can use Random:NextNumber() which I find easier to avoid doing the above maths needed to modify the maths. The cons is that you have to setup the random object first at the start of the script and never change it.
Wow, I guess I didn’t understand the documentation before properly. Thanks mate! Really helped out! ^^
i know im late but all you need to do is
math.random(0,100)/100
you can replace both numbers as you wish