Skip to content

Commit

Permalink
hosts/windows: Fix random.seed to take a parameter
Browse files Browse the repository at this point in the history
Instead of automatically seeding from the current time, allow
applications to specify the seed like other snek ports.

Signed-off-by: Keith Packard <keithp@keithp.com>
  • Loading branch information
keith-packard committed Dec 24, 2022
1 parent d9f88c3 commit dcdea5d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion hosts/windows/snek-windows.builtin
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
exit, 1
time.sleep, 1
time.monotonic, 0
random.seed, 0
random.seed, 1
random.randrange, 1
#include "snek-windows.h"
4 changes: 2 additions & 2 deletions hosts/windows/snek-windows.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ snek_builtin_time_monotonic(void)
}

snek_poly_t
snek_builtin_random_seed(void)
snek_builtin_random_seed(snek_poly_t a)
{
srand(GetTickCount());
srand(a.u);
return SNEK_NULL;
}

Expand Down

0 comments on commit dcdea5d

Please sign in to comment.