Add: program: words version 1

This commit is contained in:
xamidev
2024-07-24 15:08:39 +02:00
parent b352d3f4e2
commit 631099a53d
10 changed files with 104 additions and 10 deletions

View File

@@ -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;
}