vendredi 22 novembre 2019

Lua non-integer randomise

I'm new at LUA and I need a help with code in using function math.random(...). The problem is if I need to generate integer values I just use

math.random(-1, 1) -- This is gonna be -1, 0 or 1. Profit.

But if I need non-integers between -1 and 0?

math.random(-1.0, 1.0) -- Still -1, 0 or 1. No profit.

I tried using this: -1.01, 1.01 but it is not gonna generate a number between values exactly I need.

How do I generate non-integer value between 1 and 0?




Aucun commentaire:

Enregistrer un commentaire