std.random suggestions

0xEAB desisma at heidel.beer
Sun Sep 21 21:44:54 UTC 2025


On Tuesday, 16 September 2025 at 12:04:20 UTC, Denis Feklushkin 
wrote:
> No need to make ambitious interfaces

`std.internal.entropy` an internal module — not meant for user 
code.
 From a user’s perspective, there is nothing to interface with.

> 1. Do not provide any access about entropy sources (I am about 
> std.internal.entropy.EntropySource.tryAll and 
> forceEntropySource). At the application programming level we 
> usually have one source of true entropy. (If this is not so

`tryAll` in particular exists so that the module can be used in a 
backwards compatible manner to replace the low entropy solutions 
previously used underneath by Phobos. We’ve tried replacing them 
with one solution per platform directly and people got upset.

> At the application programming level we usually have one source 
> of true entropy.

At Phobos v2 level, we have no source of true entropy. An 
application using only that library has therefore none.

At system level, there might be multiple options available — 
depending on factors like the OS version (like Linux kernels 
older than the `getrandom` syscall, or Windows that has two 
crypto APIs where the supported parameters have also changed over 
time) or the runtime environment (think of chroots without 
`/dev/`).


More information about the Digitalmars-d mailing list