How to get a decimal as a random number

image

My question is that - “how can I get a random number between the numbers below?”
0.1 and 0.8
0.1 and 0.6

local Rng = Random.new()

local x = Rng:NextNumber(0.01, 0.8)
local y = Rng:NextNumber(0.1, 0.6)
1 Like

Something like

math.random(0,100)/100--hundredth 
math.random(0,10)/10--Tenths

You get the idea?

My math was wrong at first :cry:*

1 Like

local x = math.random(1, 80)/100
local y = math.random(10, 60)/100

Something like this would work (basicly E_x’s method). What it is doing is its working out the random number using whole numbers and then its just dividing it by the correct amount (in this case its 100) to get the final decimal that you need.

EDIT: if this does work then please give the solution to E_x as they were the one who came up with it.

1 Like

Yea… just noticed as i was going my math was wrong :pensive: