std.random suggestions
Denis Feklushkin
feklushkin.denis at gmail.com
Tue Sep 16 20:24:03 UTC 2025
On Tuesday, 16 September 2025 at 19:58:59 UTC, monkyyy wrote:
>>> 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.
>
> Insecure randomness can just grab unixtime and poke it once.
> Your adding allot of complexity
I think maybe you just didn't understand the idea.
I propose to simplify everything by throwing out some seed
abstractions and classes. Because that they are not needed by 99%
of users, and those who will need them easily will make them
themselves (I will show how below)
And also I suggested simple functions (not classes with ctros and
methods) for just. obtaining. randomized. buffer. (that are
currently lacking because we are afraid to break the laws and get
caught by the crypto-police)
(I thought that maybe proposed functions will be compatible with
betterC? Hmm)
> that I would manually untangle to find "better" 64 bits of data
>
>> For repeating sequences, I also proposed a solution.
>
> You proposed one new api (I get to learn, fun) that solves 1
> kind of determistic replay, off the top of my head I can think
> of 3
>
> You simply ignored my fuzzing example, to replay failed fuzzing
> unit tests you would need to be able to replay the sequence
> *from separate compiles and execution*. No Im not storing that
> manually, I need 5 lines of code ported from c ("unsafe"
> randomness is trivial everyone) and a someplace where a 64 bit
> int exists. The fuzzing lib then conditionally sets the seed or
> reports it before use.
I ignored it because I thought the answer was obvious. No one
will take away your seeding and `Random()`:
"seed" is just "true random" sequence, yes? It will be provided
by `std.random.truerandom.getTrueRandom()` call
`Random()` is just one of `std.random.predetermined` functions
That's all. And you know what it is and how it works.
More information about the Digitalmars-d
mailing list