home
·
contact
·
privacy
projects
/
plomrogue
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
66bc253
)
Don't use variables for what's not variable.
author
Christian Heller
<c.heller@plomlompom.de>
Sun, 26 May 2013 03:59:35 +0000
(
05:59
+0200)
committer
Christian Heller
<c.heller@plomlompom.de>
Sun, 26 May 2013 03:59:35 +0000
(
05:59
+0200)
roguelike.c
patch
|
blob
|
history
diff --git
a/roguelike.c
b/roguelike.c
index c91c407360c100d71921f82ab39631b1d676197e..2952daf94e548e33acd16d5a9a94cc82677b0e51 100644
(file)
--- a/
roguelike.c
+++ b/
roguelike.c
@@
-10,12
+10,9
@@
uint16_t rrand() {
// Pseudo-random number generator (LGC algorithm). Use instead of rand() to ensure portable predictability.
uint16_t rrand() {
// Pseudo-random number generator (LGC algorithm). Use instead of rand() to ensure portable predictability.
- uint32_t a = 1103515245; // Values for a and b as recommended by POSIX.1-2001 (see man page rand(3)).
- uint16_t b = 12345;
- uint32_t mod = 2147483648;
static uint32_t seed = 0;
static uint32_t seed = 0;
- seed = ((seed *
a) + b) % mod;
- return (seed / 65536); } // Ignore least significant 16 bits (they are less random).
+ seed = ((seed *
1103515245) + 12345) % 2147483648; // Values as recommended by POSIX.1-2001 (see rand(3)).
+ return (seed / 65536); }
// Ignore least significant 16 bits (they are less random).
void toggle_window (struct WinMeta * win_meta, struct Win * win) {
// Toggle display of window win.
void toggle_window (struct WinMeta * win_meta, struct Win * win) {
// Toggle display of window win.