1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +00:00

Replace the existing PRNG (Xorshift31) with (minimal) PCG (XSH-RR variant with 32-bit output, 64-bit state).

PCG is better than many alternatives by many metrics (see www.pcg-random.org) including statistical quality with good speed.
This commit is contained in:
Ferenc Arn
2017-01-14 23:34:51 -06:00
parent 5dde810aa5
commit 4c9004671a
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);