diff options
author | nia <nia@NetBSD.org> | 2020-07-21 02:42:05 +0000 |
---|---|---|
committer | nia <nia@NetBSD.org> | 2020-07-21 02:42:05 +0000 |
commit | 28db4ccb3e2ee071d561e6ab9f075e7deb65fdb6 (patch) | |
tree | 05cb4f0f1fcec4ae608bbe185c7f3eef2363a792 /tetris/tetris.h | |
parent | 41ea0dbfd0fa937c96c965324e8f01aa9864130e (diff) | |
download | bsdgames-darwin-28db4ccb3e2ee071d561e6ab9f075e7deb65fdb6.tar.gz bsdgames-darwin-28db4ccb3e2ee071d561e6ab9f075e7deb65fdb6.tar.zst bsdgames-darwin-28db4ccb3e2ee071d561e6ab9f075e7deb65fdb6.zip |
tetris: Use arc4random_uniform instead of modulo for better randomness
Diffstat (limited to 'tetris/tetris.h')
-rw-r--r-- | tetris/tetris.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tetris/tetris.h b/tetris/tetris.h index 7d18a2d1..8e1479f1 100644 --- a/tetris/tetris.h +++ b/tetris/tetris.h @@ -1,4 +1,4 @@ -/* $NetBSD: tetris.h,v 1.15 2016/03/03 21:38:55 nat Exp $ */ +/* $NetBSD: tetris.h,v 1.16 2020/07/21 02:42:05 nia Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -130,7 +130,7 @@ struct shape { }; extern const struct shape shapes[]; -#define randshape() (&shapes[random() % 7]) +#define randshape() (&shapes[arc4random_uniform(7)]) extern const struct shape *nextshape; |