digitalmars.D.bugs - [Issue 19075] New: rt.util.random.Rand48.defaultSeed should prefer
- d-bugmail puremagic.com (23/23) Jul 10 2018 https://issues.dlang.org/show_bug.cgi?id=19075
https://issues.dlang.org/show_bug.cgi?id=19075 Issue ID: 19075 Summary: rt.util.random.Rand48.defaultSeed should prefer RDTSC or mach_absolute_time to ctime.time Product: D Version: D2 Hardware: x86_64 OS: All Status: NEW Severity: enhancement Priority: P1 Component: druntime Assignee: nobody puremagic.com Reporter: n8sh.secondary hotmail.com `rt.util.random.Rand48.defaultSeed` generates a seed from the clock using `ctime.time`. With `D_InlineAsm_X86_64` it would be better to use the `rdtsc` instruction because it is much faster as well as being finer precision. (Finer precision is a benefit not because we care about accurate time, but because the differences between seeds generated this way are potentially greater.) The same is true of `mach_absolute_time` on macOS. The Microsoft Windows equivalent would be `QueryPerformanceCounter` but I haven't benchmarked it to verify that it is faster than `ctime.time`. --
Jul 10 2018