[Commits] [wesnoth/wesnoth] f5c64a: use mt19937 also in default random generator

GitHub noreply at github.com
Tue Aug 4 21:33:14 UTC 2015


  Branch: refs/heads/master
  Home:   https://github.com/wesnoth/wesnoth
  Commit: f5c64af8dec7851f82bab42207525eb93685812a
      https://github.com/wesnoth/wesnoth/commit/f5c64af8dec7851f82bab42207525eb93685812a
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2015-08-04 (Tue, 04 Aug 2015)

  Changed paths:
    M src/random_new.cpp
    M src/random_new.hpp
    M src/synced_context.cpp
    M src/synced_context.hpp

  Log Message:
  -----------
  use mt19937 also in default random generator

previously rng::next_random_impl() returned rand() which is in range
1-2^16. so random_new::generator->next_random() would return a number
1-2^16 in unsynced context and a number in 1-2^32 in synced contexts.
Now it always returns a number in 1-2^32.


  Commit: 2cd2cf47c027e25cd6c617633b045f0b6b008971
      https://github.com/wesnoth/wesnoth/commit/2cd2cf47c027e25cd6c617633b045f0b6b008971
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2015-08-04 (Tue, 04 Aug 2015)

  Changed paths:
    M src/scripting/game_lua_kernel.cpp
    M src/scripting/game_lua_kernel.hpp

  Log Message:
  -----------
  add wesnoth.random lua function

wesnoth.random has the same interface as math.random. So it can
substitute that function easily.


  Commit: 0038448fcbda9e0a364597f48aa61cea8c16d29e
      https://github.com/wesnoth/wesnoth/commit/0038448fcbda9e0a364597f48aa61cea8c16d29e
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2015-08-04 (Tue, 04 Aug 2015)

  Changed paths:
    M data/lua/helper.lua

  Log Message:
  -----------
  make helper.shuffle synced

using helper.shuffle now doesn't casue OOS anymore used. It is possible
to get the old behaviour by passing math.random as a second parameter.


  Commit: 39ffd1e37d6d5a7fc27e696d60204e7fbcedb68a
      https://github.com/wesnoth/wesnoth/commit/39ffd1e37d6d5a7fc27e696d60204e7fbcedb68a
  Author: gfgtdf <tischpapier at gmail.com>
  Date:   2015-08-04 (Tue, 04 Aug 2015)

  Changed paths:
    M data/lua/helper.lua
    M src/random_new.cpp
    M src/random_new.hpp
    M src/scripting/game_lua_kernel.cpp
    M src/scripting/game_lua_kernel.hpp
    M src/synced_context.cpp
    M src/synced_context.hpp

  Log Message:
  -----------
  Merge pull request #441 from gfgtdf/lua_random

Add wesnoth.random and sync helper.shuffle


Compare: https://github.com/wesnoth/wesnoth/compare/5aab187ee61d...39ffd1e37d6d


More information about the Commits mailing list