Skip to content

Commit

Permalink
Remove bit shuffling in randomness
Browse files Browse the repository at this point in the history
The LCG seems to work about as well for the important usages.
  • Loading branch information
TurkeyMcMac committed Mar 7, 2021
1 parent 245748e commit 9aed766
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/rand.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

RAND_TYPE rand_gen(RAND_TYPE *rand)
{
/* Use and LCG. */
/* LCG: */
*rand = (MAX_RAND & (1103515245UL * *rand)) + 12345;
/* Shuffle bits somewhat in case lower bits are biased. */
*rand = (MAX_RAND & (*rand << 4)) | ((0xF0000000UL & *rand) >> 28);
return *rand;
}
2 changes: 1 addition & 1 deletion src/version.h
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/* The version of the program: */
#define VERSION "0.5.4"
#define VERSION "0.5.5"

0 comments on commit 9aed766

Please sign in to comment.