Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- wandom
- -- > suwacrab
- local rand_index = 0
- local rand_lut = {}
- for i = 0,1023 do rand_lut[i] = 1 - (math.random()*2) end
- local rand = function() -- returns float between 0 and 1
- rand_index = (rand_index+1)%1024
- return rand_lut[rand_index]
- end
- local rand_float = function(a,b) -- returns float between a and b
- local n = a + (b - a) * rand()
- return n
- end
- local rand_int = function(a,b) -- returns integer between a and b
- return math.floor( rand_float(a,b) )
- end
- return {
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement