projects
/
open-adventure.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
If divident negative, then remainder is negative too.
[open-adventure.git]
/
misc.c
diff --git
a/misc.c
b/misc.c
index 302e61cc641d4faeac7b176839ddd2aa05cac9a1..80e4352b74b7b2ea8feee8a2d91798e50d61c9f7 100644
(file)
--- a/
misc.c
+++ b/
misc.c
@@
-646,8
+646,10
@@
bool tstbit(long mask, int bit)
void set_seed(int32_t seedval)
/* Set the LCG seed */
{
void set_seed(int32_t seedval)
/* Set the LCG seed */
{
- game.lcg_x = (uint32_t) seedval % LCG_M;
-
+ game.lcg_x = seedval % LCG_M;
+ if (game.lcg_x < 0) {
+ game.lcg_x = LCG_M + game.lcg_x;
+ }
// once seed is set, we need to generate the Z`ZZZ word
for (int i = 0; i < 5; ++i) {
game.zzword[i] = 'A' + randrange(26);
// once seed is set, we need to generate the Z`ZZZ word
for (int i = 0; i < 5; ++i) {
game.zzword[i] = 'A' + randrange(26);