Range Redesign: Empty Ranges

Adam Wilson flyboynw at gmail.com
Wed Mar 6 00:11:10 UTC 2024


On Tuesday, 5 March 2024 at 16:41:34 UTC, Alexandru Ermicioi 
wrote:
> On Tuesday, 5 March 2024 at 14:39:17 UTC, Dom DiSc wrote:
>> Are there infinite ranges that are indeed not forward ranges?
>
> /dev/random could be such a range.

In the case of /dev/random I don't really see how it's a true 
infinity, you can't go infinitely backwards. It is an infinitely 
forward moving stream, so you can have the concept of "zero" and 
"positive infinity", but there is no concept of "negative 
infinity". A negative number is utter non-sense for TRNG's, as 
whatever negative number you specify would become the new "zero".

Practically there is a limit to how much entropy you can grab off 
the the chip in single chunk, so it is a bounded range, it's just 
that the boundary is somewhat fuzzy.

In short you would probably end up implementing an entropy source 
as a forward range with some large upper limit.


More information about the Digitalmars-d mailing list