Add: program: words version 1
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
#include "crypto.h"
|
||||
|
||||
int lcg(int seed)
|
||||
{
|
||||
int x = seed;
|
||||
|
||||
// Constants (ZX81 LCG)
|
||||
int a = 75;
|
||||
int c = 74;
|
||||
long m = 65537;
|
||||
|
||||
for (int i=0; i<10; i++)
|
||||
{
|
||||
x = (a*x + c) % m;
|
||||
}
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
int randint(int seed)
|
||||
{
|
||||
int x = lcg(seed);
|
||||
return x;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user