Skip to content

Commit

Permalink
posix: Fix random.seed to accept a parameter
Browse files Browse the repository at this point in the history
The standard API includes a parameter to set the random number
generator value sequence.

Signed-off-by: Keith Packard <keithp@keithp.com>
  • Loading branch information
keith-packard committed Mar 4, 2019
1 parent 86bfd48 commit 30939a9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion posix/snek-posix.builtin
Expand Up @@ -26,6 +26,6 @@ stdscr.addstr, 3
stdscr.move, 2
stdscr.refresh, 0
stdscr.getch, 0
random.seed, 0
random.seed, 1
random.randrange, 1
#include <snek-posix.h>
4 changes: 2 additions & 2 deletions posix/snek-posix.c
Expand Up @@ -64,9 +64,9 @@ snek_builtin_time_monotonic(void)
}

snek_poly_t
snek_builtin_random_seed(void)
snek_builtin_random_seed(snek_poly_t a)
{
srandom(time(NULL));
srandom(a.u);
return SNEK_NULL;
}

Expand Down

0 comments on commit 30939a9

Please sign in to comment.