this was one of the harder tasks, (for me atleast)
what i learned
i had to understand how the random num generator works in general and smthing called the
LCG (a stupi- uh.. i mean clever formula)
how i built it
since i couldn't find any useful youtube videos, i turned to google for the code and asked chatgpt to explain how it works. Here's the main function
long a = 25214903917; // These Values for a and c are the actual values found
long c = 11; // in the implementation of java.util.Random()
long previous = 0;
void rseed(long seed) {
previous = seed;
}
long rand() {
long r = a * previous + c;
previous = r;
return r;
}

Log in or sign up for Devpost to join the conversation.