Page 1 of 1

How do i use random?SOLVE

Posted: Wed Apr 10, 2013 5:29 pm
by buhb11
Hey lovers how do i use random function?

I initialized it using these lines of code :

math.random(os.time()) SOLVE IT : i forgot to add randomseed , ups
math.random()
math.random()
math.random()

smt = math.random(600)

print(smt)

Everytime when i run the app it gives me the same number 293,why? I really need to learn how to use random function because i need it into my game.
Thanks for your help!

Re: How do i use random?

Posted: Wed Apr 10, 2013 5:31 pm
by Jackim
what's the issue? it seems to be working fine.

Re: How do i use random?

Posted: Wed Apr 10, 2013 5:33 pm
by buhb11
Jackim wrote:what's the issue? it seems to be working fine.
It gives me the same number over and over again,293 even if i restart the app

Re: How do i use random?SOLVE

Posted: Wed Apr 10, 2013 7:10 pm
by Nixola
LÖVE 0.8.0 automatically does that right before calling love.load, so you don't need to do this as long as you don't call math.random before love.load

Re: How do i use random?SOLVE

Posted: Wed Apr 10, 2013 7:20 pm
by buhb11
Nixola wrote:LÖVE 0.8.0 automatically does that right before calling love.load, so you don't need to do this as long as you don't call math.random before love.load
Thx,good to know!