Somebody posted an implementation of "Mersenne Twister" a little while ago:

[link:cs.hubfs.net]

By on 12/1/2008 9:21 AM ()

You can use the Box-Muller transformation to transform uniform random numbers into normal ones.
Take the exponential of normal random numbers to get log-normal random numbers.
To get uniform random numbers in the first place you can use System.Random, but if you want better quality ones there is System.Security.Cryptography.RandomNumberGenerator.

By on 11/29/2008 9:08 PM ()

I also know that the Math.NET Iridium library has support for quite a few random number distributions.

[link:mathnet.opensourcedotnet.info]
[link:mathnet.opensourcedotnet.info]

Since it's a .NET library, you can use it from F#.

By on 11/30/2008 5:51 AM ()

Bob

I believe the .Net framework provides a uniform random number generator, although I don't know how "good" it is. In any case the usual way to obtain other distributions is via combining uniform pseudorandom numbers in different ways (depending on the distribution you're looking for.)

I'd suggest using Google. Searching "pseudorandom normal distribution" produces (among others) an article about generating normal deviates from uniform deviates based on the Central Limit Theorem.

Note that, depending on your intended use, you may also want to do some testing of whatever algorithm you try. There are quite a few tests of "randomness" that you might apply. I think one of Knuth's volumes discusses this in some detail. I might be able to dig up some particular references if you need them, but I expect Google might serve there as well.

Good luck.

Can anyone direct me to a source for random number generators for specific distributions - normal, lognormal, etc. - preferably in F#? Even good algorithms would be helpful.

Thanks.

Bob

By on 11/29/2008 8:25 PM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper