[racket] LC53
All of this talk about using Racket for numerical work reminds me of a simple function that I included in my novice package:
http://www.forth.org/novice.html
This is the LC53 linear-congruential prng (pseudo-random number generator) that I invented. Here it is using infix pseudo-code:
m = 2^32 - 5
a = 2^32 - 333333333
x(n+1) = a*x(n) mod m
Would any brave Racketeer care to implement this in Racket? Hopefully doing so won't involve rewriting the VM and the JIT. :-)
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.
BTW --- My novice package also includes a program to crack an encryption system based on LC53 or any other linear-congruential prng.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20121117/375f708a/attachment.html>