home · contact · privacy
034b0e892a56cb3aad3297fe57b72de64a8c87d1
[plomrogue] / src / server / rrand.c
1 /* src/server/rrand.c
2  *
3  * This file is part of PlomRogue. PlomRogue is licensed under the GPL version 3
4  * or any later version. For details on its copyright, license, and warranties,
5  * see the file NOTICE in the root directory of the PlomRogue source package.
6  */
7
8 #include "rrand.h"
9 #include <stdint.h> /* uint16_t */
10 #include "world.h" /* global world */
11
12
13
14 extern uint16_t rrand()
15 {   /* Constants as recommended by POSIX.1-2001 (see man page rand(3)). */
16     world.seed = ((world.seed * 1103515245) + 12345) % 4294967296;
17     return (world.seed >> 16); /* Ignore less random least significant bits. */
18 }