Pallinder/go-randomdata

Seeder bug on Windows, returns same numbers

pavel-main opened this issue · 2 comments

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.

Well, looks like Golang guys won't fix it