Arjun K R
Arjun K R

Reputation: 462

Parallel Random Number Generators

I would like to know whether there is any random number generator which can generate random numbers in parallel such that the generated sequences should not have dependency in between them.

To be specific, if i have two tasks and each tasks generate random numbers, then there must be no dependency and no overlap.

Upvotes: 2

Views: 1694

Answers (3)

Sebastian Widz
Sebastian Widz

Reputation: 2072

You might want to check this article about generating random numbers in parallel:

Getting random numbers in a thread-safe way

it helped me with the same problem some time ago.

Upvotes: 0

Tallek
Tallek

Reputation: 1575

Might want to check out this post: http://msmvps.com/blogs/jon_skeet/archive/2009/11/04/revisiting-randomness.aspx

Upvotes: 1

David
David

Reputation: 16120

The RNGCryptoServiceProvider class should meet your needs.

It's designed to be less deterministic than System.Random, and is also thread-safe.

More info here: http://msdn.microsoft.com/en-us/library/system.security.cryptography.rngcryptoserviceprovider.aspx

Upvotes: 2

Related Questions