home · contact · privacy
Strongly overhauled keybinding managemment. Window-specific keybindings and a window...
[plomrogue] / src / rrand.c
1 #include "rrand.h"
2 #include <stdint.h> /* for uint16_t, uint32_t */
3
4
5
6 static uint32_t seed = 0;
7
8
9
10 extern uint16_t rrand()
11 {
12     /* Constants as recommended by POSIX.1-2001 (see man page rand(3)). */
13     seed = ((seed * 1103515245) + 12345) % 2147483647;
14
15     return (seed >> 16);     /* Ignore less random least significant 16 bits. */
16 }
17
18
19
20 extern void rrand_seed(uint32_t new_seed)
21 {
22     seed = new_seed;
23 }