Skip to content

Commit 1ff21ed

Browse files
committed
rand: correct the initial values
The first values returned by rand() should be equal to those returned after srand(1). Reported by Yann Guidon (whygee(a)f-cpu.org), thanks!
1 parent 016404f commit 1ff21ed

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/stdlib.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ typedef struct _Alloc
6969
/* variables */
7070
extern char ** environ;
7171
static Alloc _alloc = { 0, NULL, NULL };
72-
static uint32_t _seed_lfsr = 1;
73-
static uint32_t _seed_xc = 1;
74-
static uint16_t _seed_y = 0;
72+
static uint32_t _seed_lfsr = 0x61a864db;
73+
static uint32_t _seed_xc = 0x00015894;
74+
static uint16_t _seed_y = 0xf3b8;
7575

7676

7777
/* prototypes */

0 commit comments

Comments
 (0)