Merge pull request #7532 from tagcup/pcg_prng

Replace the existing PRNG (Xorshift31) with (minimal) PCG-32.
This commit is contained in:
Rémi Verschelde 2017-01-16 20:06:54 +01:00 committed by GitHub
commit bf05dab74f
7 changed files with 54 additions and 25 deletions

View file

@ -351,14 +351,14 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va
case MATH_SEED: {
VALIDATE_ARG_COUNT(1);
VALIDATE_ARG_NUM(0);
uint32_t seed=*p_args[0];
uint64_t seed=*p_args[0];
Math::seed(seed);
r_ret=Variant();
} break;
case MATH_RANDSEED: {
VALIDATE_ARG_COUNT(1);
VALIDATE_ARG_NUM(0);
uint32_t seed=*p_args[0];
uint64_t seed=*p_args[0];
int ret = Math::rand_from_seed(&seed);
Array reta;
reta.push_back(ret);