comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Generate Same Sequence of Random Numbers in IDL and C
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Generate Same Sequence of Random Numbers in IDL and C [message #89061] Mon, 21 July 2014 09:11 Go to previous message
sweiss1993 is currently offline  sweiss1993
Messages: 4
Registered: July 2014
Junior Member
I am in the process of developing a C version of a program originally written in IDL. The programs generate arrays with random number generators. I use gsl_rng_uniform and gsl_ran_poisson in the C version, and both random number generators use the gsl_rng_mt19937 algorithm. From attempting to read GDL's source code, I noticed GDL happens to use the same functions.

I would like to compare the two versions of the program by running them with the same fixed sequence of random numbers. The rng parts of the programs are in a loop, so a new array is generated with each iteration. I would like a different set of random numbers for each iteration. So, each iteration has a different set of generated numbers, but the i-th iteration in the programs should match each other.

I could not figure out exactly how GDL sets the seed by reading the source code. Would someone be so kind as to show me how to seed the rng functions in IDL and C such that the above conditions are met? Thanks!
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: rebin vs congrid
Next Topic: IDL and C inter-language communication / call_external()

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:05:46 PDT 2025

Total time taken to generate the page: 0.00513 seconds