Commit Graph

17 Commits

Author SHA1 Message Date
Alex Szpakowski 46a2e7b85c Happy new year! 🎉 2016-01-01 00:05:06 -04:00
Alex Szpakowski c03ce3a9ab love.math.random now uses a slight variant of Xorshift (Xorshift*). 2015-10-26 20:47:56 -03:00
Alex Szpakowski 83e0efb5b4 Fixed indentation.
--HG--
branch : minor
2015-01-26 14:42:53 -04:00
Alex Szpakowski a69f722f0f love.math.setRandomSeed / RandomGenerator:setSeed now hashes the seed value before using it, which gives a much better distribution when comparing the results of different but similar seeds.
Cleaned up RandomGenerator:setState/getState, now that love is using the C++11 standard library.

--HG--
branch : minor
2015-01-26 14:13:42 -04:00
Alex Szpakowski a7e4148869 Merged default into minor
--HG--
branch : minor
2015-01-16 15:47:26 -04:00
Alex Szpakowski c7b45b3505 Updated copyright for the new year 2014-12-31 19:32:43 -04:00
Alex Szpakowski d4ad571780 Un-reverted commit 14ca947 (love.math.setRandomSeed internally calling random() a few times) for the minor branch.
--HG--
branch : minor
2014-09-28 16:05:17 -03:00
Alex Szpakowski e8009bb4cb Reverted commit 14ca947 (love.math.setRandomSeed internally calling random() a few times.) The change can break existing 0.9.x games so it will be pushed back to the minor branch. 2014-09-28 15:28:14 -03:00
Alex Szpakowski 3cf2a8f8a2 Improved error message when love.math.setRandomSeed(0) is attempted (resolves issue #876) 2014-04-24 15:21:53 -03:00
Alex Szpakowski 4ea18d8bbc love.math.setRandomSeed now calls random() a couple times internally, to make similar seeds give less similar results when random() is called for the first time after setRandomSeed. 2014-04-05 18:55:05 -03:00
Alex Szpakowski d07e31370d Added RandomGenerator:getState and RandomGenerator:setState (resolves issue #831.)
getState returns an implementation-dependent string representing the current state of the RandomGenerator's PRNG. setState sets the PRNG's state to an implementation-dependent string.
2014-02-08 20:28:41 -04:00
Alex Szpakowski 3120a0e650 Goodbye 2013, hello 2014! 2014-01-03 17:28:58 -04:00
Alex Szpakowski 1c8abc74aa Renamed love.math.g/setRandomState and rng:g/setState to love.math.g/setRandomSeed and rng:g/setSeed.
getRandomSeed now always returns the previously set random seed instead of the current (implementation-dependent) random state.
2013-12-01 21:25:27 -04:00
Alex Szpakowski 674ad9247a Added some checks for invalid numbers to love.math.setRandomState
--HG--
branch : RandomGenerator-2
2013-08-04 17:04:52 -03:00
Alex Szpakowski 0447d1e7c5 Changed love.math.randomnormal([mean], stddev) to love.math.randomNormal(stddev, [mean]);
Changed love.math.randomseed(seed) to love.math.setRandomState(state) and love.math.setRandomState(low, high). Added low, high = love.math.getRandomState().

love.math.setRandomState(state) can set the random state to an integer of up to 53 bits, love.math.setRandomState(low, high) can set the random state to a 64 bit integer by using the first argument as the lower 32 bits and the second argument as the higher 32 bits.
This allows for reliable setting and saving of the state of a RNG.

--HG--
branch : RandomGenerator-2
2013-08-01 18:32:44 -03:00
Alex Szpakowski d98e2cb40c Renamed randnormal to randomnormal
--HG--
branch : math-randobject
2013-04-15 14:57:20 -03:00
Alex Szpakowski 3046981fce Added love.math.newRandomGenerator. Returns a RNG object with its own seed and random methods.
--HG--
branch : math-randobject
2013-04-14 23:02:44 -03:00