Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Does the random class in Lua have a method for generating decimal numbers?

I know that the Random class has

NextInteger()

but in every other language I've learned there has been a method to generate a number in a range of

0 - 1

for example maybe it will generate 0.4 or 0.2

Is there a method or function to do this in lua

Any help is appreciated thank you :)

3 comments

0

The reason I'm posting this on here is the only thing I can find online pertains to the math.Random and that has been depreciated to my knowledge.

0

math.random(1, 100) * 0.01

0

or math.random(1,10) * 0.1 for 0.1-1

2 answers

✓ Accepted answer

3 comments

0

Is there a way to do it without math.Random?

0

Math.random is not deprecated. Whoever said that is trying to feed you false information.

0

Alright thank you for your help :)

The :NextNumber(lo, hi) method of the Random class produces a number in the half-open range [lo, hi), defaulting to the range [0, 1).

This discussion is preserved as it was. New answers, comments, and votes are closed.