Hi Bill,

I'm not able to consistently get different Gaussian sky-noise realizations on 
successive runs of jt65sim in my frame-error-rate script. The symptoms are 
strange, and it took me a while to figure out what’s going on. I get a string 
of unique seeds on some runs of the frame-error-rate script, but on others I 
get groups of two or sometimes a long string of identical seeds in a row. 

Turns out that the C routine, init_random_seed(), is (for some reason) not 
reading from /dev/urandom anymore (at least on my OS X laptop) and is falling 
back to time(NULL)^getpid(). This fails in my case because I happen to be 
calling the routine about once per second, in which case time and getpid 
increase in lock-step such that the bitwise XOR of time(NULL) and getpid() 
doesn’t always change between successive calls. For example, consider the time 
and getpid on these successive runs of the init_random_c test program:

time 1450406520 getpid 65606
time 1450406521 getpid 65607

The value of time^getpid is the same for these successive sets of values, so 
the seed is the same. If you hit it just right (and happen to be calling the 
program approximately once per second) you can get long strings where the seed 
never changes.

It seems like adding or multiplying the time and getpid might be safer.

Steve k9an


------------------------------------------------------------------------------
_______________________________________________
wsjt-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wsjt-devel

Reply via email to