diff options
author | kwolekr <kwolekr@minetest.net> | 2015-03-22 00:01:46 -0400 |
---|---|---|
committer | kwolekr <kwolekr@minetest.net> | 2015-03-22 00:48:08 -0400 |
commit | 3993093f51544d4eb44efb57c973e29107ea2f7a (patch) | |
tree | 0533167edce0dbd2cb8f03c37b880e57cfd7916d /src/mapgen.cpp | |
parent | 7679396ebbb38115eedbfb8e9636dff50cdf2075 (diff) | |
download | minetest-3993093f51544d4eb44efb57c973e29107ea2f7a.tar.gz minetest-3993093f51544d4eb44efb57c973e29107ea2f7a.tar.bz2 minetest-3993093f51544d4eb44efb57c973e29107ea2f7a.zip |
Add support for the PCG32 PRNG algo (and associated script APIs)
Diffstat (limited to 'src/mapgen.cpp')
-rw-r--r-- | src/mapgen.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/mapgen.cpp b/src/mapgen.cpp index fd4fe5bb0..851f018ee 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -515,14 +515,10 @@ void MapgenParams::load(const Settings &settings) std::string seed_str; const char *seed_name = (&settings == g_settings) ? "fixed_map_seed" : "seed"; - if (settings.getNoEx(seed_name, seed_str) && !seed_str.empty()) { + if (settings.getNoEx(seed_name, seed_str) && !seed_str.empty()) seed = read_seed(seed_str.c_str()); - } else { - seed = ((u64)(myrand() & 0xFFFF) << 0) | - ((u64)(myrand() & 0xFFFF) << 16) | - ((u64)(myrand() & 0xFFFF) << 32) | - ((u64)(myrand() & 0xFFFF) << 48); - } + else + myrand_bytes(&seed, sizeof(seed)); settings.getNoEx("mg_name", mg_name); settings.getS16NoEx("water_level", water_level); |