Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to generate random float in lua?

Tags:

random

lua

I need to generate random float in Lua. It needs to be > 1, so math.random() is not a solution.

How can I do this?

like image 529
user0103 Avatar asked Jul 18 '12 18:07

user0103


1 Answers

This should generate random floats between 1 (inclusive) and 100 (exclusive)

math.random() + math.random(1, 99)
like image 165
peacemaker Avatar answered Oct 15 '22 13:10

peacemaker