Talk:Random numbers

From Legacy Roblox Wiki
Jump to navigationJump to search

I haven't tried this, but what about:

x = math.random(1, 100)
y = math.random(1, 100)
rand = math.random(x, y)

--N2KC 21:40, 14 March 2008 (CDT)

You want to use math.randomseed(game:GetService("RunService").Stepped:wait()) --Telamon 12:58, 24 March 2008 (CDT)

If we had the OS.Time function we could generate random numbers based on the current time/date as a seed. ---Mr Doom Bringer 16:39, 24 March 2008 (CDT)

Oh, of course. I forgot about randomseed... --N2KC 01:33, 30 March 2008 (CDT)

But... couldn't you just program the OS. Time functions? O.o

Improved

I did a run of a few random number tests, and this is what I got: > for i = 1, 10 do print(math.random(1,100)) wait(1) end
86 74 61 58 37 16 23 43 81 52
70 99 76 35 17 66 50 7 70 51
26 15 95 15 91 70 31 43 8 97
64 69 16 88 83 59 20 18 82 48
94 16 51 74 41 28 57 69 76 73
47 48 13 37 84 4 52 67 43 11
85 95 93 55 35 48 38 85 32 46
58 28 99 30 74 57 20 77 84 40
88 51 90 3 100 58 6 54 20 85

That's certainly better than what we had before (which all started with 1...) I'll say that we don't need the fanciness of the "truly random numbers", other than for mathematical puress. MINDRAKER 06:40, 24 August 2008 (CDT)