1. Anders Ruud
  2. love

Issues

Issue #732 resolved

Seeding love.math.random in love.run

hahawoo
created an issue

I'd suggest that maybe love.math.random should be seeded in love.run. I'd assume more often than not, people would want a random initial state, or if they didn't they may want to set it themselves rather than using whatever state love.math.random currently starts with.

Also maybe math.randomseed doesn't need to be called in love.run now that there is love.math.random, which people are probably going to want to use since it's better than math.random (in some ways I don't yet understand :D), right?

Comments (3)

  1. Mark Wonnacott

    This is a very annoying change for me as I don't really want to change all my math.random calls to love.math.random calls when math.random is sufficient and there doesn't seem to be any benefit to not seeding math.random too :/

  2. hahawoo reporter

    On the subject of changing math.random to love.math.random, I'm sure this is kind of annoying, but I guess it's only a search-and-replace away. Or math.randomseed could be called in love.load maybe? Or math.random = love.math.random.

    As for there being no benefit to not seeding math.random, I'd propose that there actually might be.

    Let's say both math.random and love.math.random were seeded in love.run.

    This is slightly more complex than just seeding one of them.

    But what I think the real issue is that the design says "I'm preparing you to use both math.random and love.math.random." It then appears that, for obtaining a random number, there are "two ways of doing the same thing", which can be confusing. Which one do you pick? When only love.math.random is seeded automatically, the lover is guided to select the "better" random generator (How it's better is beyond my current understanding. :P).

  3. Log in to comment