Using Math.Random() in a theme script practically always returns zero.
This is because ply_get_random_number uses mrand48 which, while
returning a 64-bit long, restricts the range of its return value
to be no more than 32-bit, and so gets improperly normalized.
This commit addresses the problem by calling mrand48() twice, once for
each 32-bits of the returned value.
https://gitlab.freedesktop.org/plymouth/plymouth/-/issues/256
seed_initialized = true;
}
- offset = mrand48 ();
+ offset = (mrand48 () << 32) | (mrand48 () & 0xffffffff);
offset = labs (offset) % range;