--- deliantra/server/common/rng.C 2011/04/23 04:56:46 1.3 +++ deliantra/server/common/rng.C 2018/11/17 23:40:00 1.9 @@ -1,22 +1,23 @@ /* * This file is part of Deliantra, the Roguelike Realtime MMORPG. - * - * Copyright (©) 2010,2011 Marc Alexander Lehmann / Robin Redeker / the Deliantra team - * + * + * Copyright (©) 2017,2018 Marc Alexander Lehmann / the Deliantra team + * Copyright (©) 2010,2011,2012,2013,2014,2015,2016 Marc Alexander Lehmann / Robin Redeker / the Deliantra team + * * Deliantra is free software: you can redistribute it and/or modify it under * the terms of the Affero GNU General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the Affero GNU General Public License * and the GNU General Public License along with this program. If not, see * . - * + * * The authors can be reached via e-mail to */ @@ -26,7 +27,7 @@ rand_gen rndm, rmg_rndm; -void noinline +ecb_noinline void tausworthe_rng::seed (uint32_t seed) { state [0] = seed * 69069U; if (state [0] < 2U) state [0] += 2U; @@ -49,7 +50,7 @@ return state [0] ^ state [1] ^ state [2] ^ state [3]; } -void noinline +ecb_noinline void r250521_rng::seed (uint32_t seed) { xorshift_rng rng; @@ -74,28 +75,28 @@ } template -uint32_t noinline +ecb_noinline uint32_t random_number_generator::get_u32 () { return generator::next (); } template -uint64_t noinline +ecb_noinline uint64_t random_number_generator::get_u64 () { return (uint64_t (get_u32 ()) << 32U) | get_u32 (); } template -float noinline +ecb_noinline float random_number_generator::get_float () { return this->next () / (float)0x100000000ULL; } template -double noinline +ecb_noinline double random_number_generator::get_double () { return this->next () / (double)0x100000000ULL; @@ -103,7 +104,7 @@ // return a number within (min .. max) template -int +int random_number_generator::get_range (int r_min, int r_max) { return r_min + get_range (max (r_max - r_min + 1, 0));