Randomness, with Löve

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
Roland_Yonaba
Inner party member
Posts: 1563
Joined: Tue Jun 21, 2011 6:08 pm
Location: Ouagadougou (Burkina Faso)
Contact:

Randomness, with Löve

Post by Roland_Yonaba »

Hi,

I just was just reading the native implementation of love.run on the wiki.
So, from what I can see, the pseudo random generator is reset with a seed based on current time each time löve is started.

Code: Select all

    math.randomseed(os.time())
    math.random() math.random()
Actually, as some of you might be aware of, on some others frameworks, when you need randomness, using just math.random() will return the same sequence of values, even after restarted your Lua app.
Well, can I conclude that using math.randomseed later on is pointless as love.run already takes care of that ?
Unless one need to work with a specific seed ...
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Randomness, with Löve

Post by bartbes »

This was added in 0.8.0, and it should seed (and discard the first few known-to-not-be-too-random-sometimes values) now. So generally speaking you don't need to seed yourself.
Post Reply

Who is online

Users browsing this forum: TurboYeti and 3 guests