Default math.rand.Source is thread save while rand.New(Source) is not
2016-03-13 ::
( 1 minutes reading )
Default pacakge rand uses Source that is thread safe with default seed 1
we can use the pacakge’s method to have thread safe random number generation
|
|
But the rand.NewSource()
offers thread unsafe implementation.
One of the reason to choose the unsafe implementation to avoid
synchronization, especially when you have only single go routine.
|
|