How do i use random?SOLVE

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
buhb11
Citizen
Posts: 81
Joined: Wed Dec 26, 2012 8:59 pm

How do i use random?SOLVE

Post 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!
Last edited by buhb11 on Wed Apr 10, 2013 5:37 pm, edited 3 times in total.
I found Love very enjoyable and nice!
Jackim
Prole
Posts: 12
Joined: Wed Apr 03, 2013 3:02 am
Location: Canada

Re: How do i use random?

Post by Jackim »

what's the issue? it seems to be working fine.
User avatar
buhb11
Citizen
Posts: 81
Joined: Wed Dec 26, 2012 8:59 pm

Re: How do i use random?

Post 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
I found Love very enjoyable and nice!
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: How do i use random?SOLVE

Post 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
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
User avatar
buhb11
Citizen
Posts: 81
Joined: Wed Dec 26, 2012 8:59 pm

Re: How do i use random?SOLVE

Post 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!
I found Love very enjoyable and nice!
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 2 guests