Convencience function for random + entropy function.

This commit is contained in:
Christoffer Lerno
2023-10-31 22:21:38 +01:00
parent cd7a03c2cf
commit 120e21b80b
4 changed files with 43 additions and 4 deletions

View File

@@ -69,10 +69,8 @@ fn void Game.update(Game *game, int guess)
fn void! main()
{
Lcg128Random rand;
random::seed(&rand, clock::now());
int high = 100;
int answer = random::next(&rand, high) + 1;
int answer = rand(high) + 1;
Game game = { .answer = answer, .high = high };
(void)game.play();
io::printfn("Finished in %d guesses.", game.guesses);