- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
We are porting our application to various platforms where Intel MKL isn't available and using the NAG C Library to fill in. We noticed that both packages offer the Wichmann-Hill pseudorandom number generator, and we would like to make it so that given the same seed, the same output will be produced. However, according to the description and implementation of Wichmann-Hill on NAG, four seeds and a generator ID must be provided to initialize the stream while the VSL library uses a single seed when initializing. Thus, we can't see any immediate way of analogously seeding the two streams.
Is there a way in which, given a seed, we may produce the same output so that we can get consistent results across platforms?
Thanks
Is there a way in which, given a seed, we may produce the same output so that we can get consistent results across platforms?
Thanks
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for your question.
Wichmann-Hill pseudorandom number generator requires 4 seeds for its initialization. To pass them into the library you need to use vslNewStreamEx routine. Example below demonstrates how it works:
...
#define BRNG VSL_BRNG_WH
#define METHOD 0
#define N 1000
#define NSEED 4
...
#define BRNG VSL_BRNG_WH
#define METHOD 0
#define N 1000
#define NSEED 4
...
int main()
{
unsigned int seed[NSEED];
double r;
VSLStreamStatePtr stream;
{
unsigned int seed[NSEED];
double r
VSLStreamStatePtr stream;
seed[0] = 123;
seed[1] = 124;
seed[2] = 125;
seed[3] = 126;
...
vslNewStreamEx( &stream, BRNG, NSEED, seed );
vdRngUniform( METHOD, stream, N, r, 0.0, 1.0 );
vslDeleteStream( &stream );
...
return 0;
}
seed[1] = 124;
seed[2] = 125;
seed[3] = 126;
...
vslNewStreamEx( &stream, BRNG, NSEED, seed );
vdRngUniform( METHOD, stream, N, r, 0.0, 1.0 );
vslDeleteStream( &stream );
...
return 0;
}
If for some reasons number of seeds passed into the library is less than 4 (for example, when vslNewStream function is used for the initialization of the stream) the remaining seeds are set to thedefault values. More details about initialization of the Wichmann-Hill generator can be found in the Vslnotes.pdf (http://www.intel.com/software/products/mkl/docs/vslnotes.pdf),
section Testing of Basic Random Number Generators->Basic Random Generator Properties and Testing Results->WH.
section Testing of Basic Random Number Generators->Basic Random Generator Properties and Testing Results->WH.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page