In message , Matt Calder writes >Geoff, > Here is a random number generator written in C. It is the >same one used in the statistics package S-plus and since that is a >commercial package it must be good right? I use it too and have never >found anything wrong with it, I think it >is a form of nonlinear >congruential generator though I am not an expert by any means. I'd be very careful about using a random number generator that hadn't been properly tested. Just because it is used commercially doesn't mean that it is any good! Have a look at Knuth, The Art of Computer Programming, for good random number generator algorithms. A good example of where problems can arise is in cryptography, where what appears to be a good cryptographic technique (like PGP) which uses a poor random number generator can make it easy to crack the encryption. Leon -- Leon Heller Amateur radio callsign: G1HSM Email: leon@lfheller.demon.co.uk http://www.lfheller.demon.co.uk Tel: +44 (0) 118 947 1424 (home) +44 (0) 1344 385556 (work)