On 12/07/2015 13:29, Steven Franke wrote: > Hi Bill, Hi Steve, ... > Comments and suggestions welcome! >> I see that wsprd makes use of rand() but doesn't appear to seed the >> pseudo RNG. This is somewhat tricky since the normal way the wsprd is >> started is on a timer and using the usual srand(time(NULL)) will not >> necessarily be valid across a global network of time synchronized >> computers. I am not a fan of spawning a process to do what is >> essentially a simple procedure call so I will leave this to you to find >> a way to seed the PRNG for wsprd. Perhaps srand(getpid()) might be better. > It is still pre-coffee here, so forgive me if I’m missing the point — but I > believe that the only use of rand() associated with wsprd would be in > wsprsim.c where rand is used to generate noise when producing a .c2 file > containing a (simulated) noisy signal. I will address this, but I don’t think > that it comes into play for wsjt-x users, since wsprsim is a “utility” > program used for development purposes. Ah OK, I was looking at the gran() function but I see, looking at it properly, that is not used in wsprd. There is no issue here. > > Or were you referring to my use of rand() in WsprTxScheduler? Should rand() > be replaced with qrand() in WsprTxScheduler.cpp? As that is only called from the GUI thread I believe that is reasonably OK but you should be aware that the Modulator class runs in a separate thread and can use a PRNG in an obscure use case (simulated noise), so that does technically mean that there is a multi-threading hazard that qsrand() would avoid since that uses rand_r() in MT applications.
73 Bill G4WJS. ------------------------------------------------------------------------------ Don't Limit Your Business. Reach for the Cloud. GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today. https://www.gigenetcloud.com/ _______________________________________________ wsjt-devel mailing list wsjt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wsjt-devel