std.random suggestions
H. S. Teoh
hsteoh at qfbox.info
Tue Sep 16 19:06:27 UTC 2025
On Tue, Sep 16, 2025 at 06:59:01PM +0000, Denis Feklushkin via Digitalmars-d wrote:
> On Tuesday, 16 September 2025 at 12:08:38 UTC, Richard (Rikki) Andrew
> Cattermole wrote:
> > On 17/09/2025 12:04 AM, Denis Feklushkin wrote:
> > > Perhaps this is suitable for Phobos 3?
> >
> > Not for V2.
>
> There is also a suggestion to urgently fix problem with "true" random
> numbers in Phobos v2 right now: it is just need to extend
> `std.random.unpredictableSeed` template with template argument ubyte[]
>
> Such patch will be accepted?
I'm not the one making decisions here, but from what I understand,
std.random.unpredictableSeed is not meant to be a general interface for
getting random bytes from the OS. It's meant to be an abstraction for
obtaining a (small) system-dependent value suitable for seeding
pseudo-random generators like the ones you'd use for games or Monte
Carlo simulations. It just so happened that whoever implemented
.unpredictableSeed decided to make use of OS random number APIs for
obtaining this seed, but it was never meant for user code to call
.unpredictableSeed as a source of random numbers.
If you want an API for getting random numbers from the OS, you probably
need to propose a new module, or at the very least a new function in
std.random.
T
--
People who are more than casually interested in computers should have at least some idea of what the underlying hardware is like. Otherwise the programs they write will be pretty weird. -- D. Knuth
More information about the Digitalmars-d
mailing list