Seeder bug on Windows, returns same numbers
pavel-main opened this issue · 2 comments
pavel-main commented
While executing this operation multiple times on Windows 8.1 x64:
fmt.Println(StringNumber(4, "-"))
I get strange results:
44-44-44-44
55-55-55-55
11-11-11-11
00-00-00-00
If we look at seedAndReturnRandom() function, we can find:
rand.Seed(time.Now().UnixNano())
This probably happens because golang executes faster than nanosecond passes. Should we sleep for a while before seeding, implement different seeding algorithm or it's a platform-specific bug?
P.S. My co-worker launched this test on Gentoo, and it works properly.
pavel-main commented
I've also posted this on golang bugtracker https://code.google.com/p/go/issues/detail?id=8926&thanks=8926&ts=1413195728
pavel-main commented
Well, looks like Golang guys won't fix it