<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;">All of this talk about using Racket for numerical work reminds me of a simple function that I included in my novice package:</div><div>http://www.forth.org/novice.html<br></div><div style="color: rgb(0, 0, 0); font-size: 15.555556297302246px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;">This is the LC53 linear-congruential prng (pseudo-random number generator) that I invented. Here it is using infix pseudo-code:</div><div style="font-size: 15.555556297302246px; background-color: transparent;">m = 2^32 - 5</div><div style="color: rgb(0, 0, 0); font-size: 15.555556297302246px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style:
 normal;">a = 2^32 - 333333333</div><div style="color: rgb(0, 0, 0); font-size: 15.555556297302246px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;"><span style="background-color: transparent;">x(n+1) = a*x(n) mod m</span><br></div><div style="color: rgb(0, 0, 0); font-size: 15.555556297302246px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;"><span style="background-color: transparent;"><br></span></div><div style="color: rgb(0, 0, 0); font-size: 15.555556297302246px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;"><span style="background-color: transparent;">Would any brave Racketeer care to implement this in Racket? Hopefully doing so won't involve rewriting the VM and the JIT. :-)</span></div><div style="color: rgb(0, 0, 0); font-size: 15.555556297302246px;
 font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;"><span style="background-color: transparent;"><br></span></div><div style="color: rgb(0, 0, 0); font-size: 15.555556297302246px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;"><span style="background-color: transparent;">Note that when I invented LC53, the 32-bit x86 was still prevalent and I was assuming that the system would be 32-bit. Implementing LC53 on the 64-bit x86 using 64-bit registers is too easy --- so for this exercise, please assume that you are using a 32-bit processor. As often happens in numerical programs, overflow of intermediate values will be an issue.</span></div><div style="color: rgb(0, 0, 0); font-size: 15.555556297302246px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;"><br></div><div
 style="color: rgb(0, 0, 0); font-size: 15.555556297302246px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;"><span style="background-color: transparent;">BTW --- My novice package also includes a program to crack an encryption system based on LC53 or any other linear-congruential prng.</span></div><div style="color: rgb(0, 0, 0); font-size: 15.555556297302246px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;"><span style="background-color: transparent;"><br></span></div>  </div></body></html>