You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2019/02/15 07:14:23 UTC

[GitHub] yzhliu edited a comment on issue #13574: Replaced rand_r with std:: random generation

yzhliu edited a comment on issue #13574: Replaced rand_r with std:: random generation
URL: https://github.com/apache/incubator-mxnet/pull/13574#issuecomment-463932903
 
 
   Usually using `thread_local` rand generator is not a good idea, not only in the sense of system design, but it could be invalid.
   
   Say if you use 4 threads to fill an array A[4], each Gaussian random generator fills one entry with its head element - `A[0] = gen1[0], A[1] = gen2[0], A[2] = gen3[0], A[3] = gen4[0]` - this array does not follow Gaussian distribution at all. Pseudorandom sequence has to be long enough in order to satisfy the distribution property. Such "bug" is rare but extremely hard to debug once occurs.
   
   Also it will be great to let users set their global seed, as some (maybe not-well-designed) algorithms are sensitive to seed number. This means all random generators within the system should take same input seed as their constructor argument. (I know currently this rule is not well followed in mxnet though.)
   
   This is why `RandGenerator` is implemented so complicated.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services