std.random suggestions
Denis Feklushkin
feklushkin.denis at gmail.com
Tue Sep 16 19:25:58 UTC 2025
On Tuesday, 16 September 2025 at 18:59:48 UTC, monkyyy wrote:
> On Tuesday, 16 September 2025 at 18:10:22 UTC, Denis Feklushkin
> wrote:
>> On Tuesday, 16 September 2025 at 18:04:20 UTC, Monkyyy wrote:
>>> On Tuesday, 16 September 2025 at 12:04:20 UTC, Denis
>>> Feklushkin wrote:
>>>> 2. Completely exclude "seeding" concept: this is a source of
>>>
>>> You can make it implict called, and leave the data public for
>>> whoever wants it.
>>
>> It is difficult to achieve this because in most cases it will
>> be just a libc getrandom() call (system-wide seeded PRNG)
>
> your suggested api does nothing for the majority of trivial
> randomness use cases
I disagree.
I proposed major step forward for our ecosystem: you can just go
and get 49 random bytes buffer. No seeding, no new calls to
Random() (or genRnd?), etc. Just get a random sequence.
All sorts of whistles and bells can be screwed on top of this, if
need.
For repeating sequences, I also proposed a solution.
And I am categorically against "universal solution" with classes,
seed-accepting constructors, and all the other overengineering as
we have now - even experienced people can't use it correctly, as
practice shows. (I myself even remember using a third-party
library to generate a random number because I was just too lazy
to figure out the standard one.)
More information about the Digitalmars-d
mailing list