Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Random number generation with ranges (Lua)
--[[ Truly random numbers Lua made by Ice Scripter This program may be updated overtime Put "random()" to use the truly random number Don't worry about code between these lines. ]] -- Added ranges by DmilkaSTD local u = 0 function random(init, range_end) -- start pseudo-random number generation u = u + 1 local regular = math.floor(math.random(math.randomseed(os.time()+u))*range_end) local count = init for i = 1, regular do if init > range_end then count = "Initial number is bigger than the end of range" break end count = count + 1 if count > range_end then count = init end end return count end -- end of pseudo-random number generation -- example -- print(random(1, 1000))
run
|
edit
|
history
|
help
0
Area of Sector Calculator
مكسر
Goalless DRAWS
Properties in Lua
W.I.P
kraft1c
Basic Lehmer RNG implementation using closures
ok
multiline string
Creating habits v2, Lua (WIP)