shuffle a character array
Mike Parker via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Jul 20 09:18:00 PDT 2016
On Wednesday, 20 July 2016 at 16:08:26 UTC, pineapple wrote:
>
> Pardon my being scatterbrained (and there not being an "edit
> post" function) - you're referring to phobos not considering
> char[] and wchar[] to have random access? The reason they are
> not considered to have random access is because they are
> auto-decoded by other functions that handle them, and the
> auto-decoding makes random access inefficient. Not because
> shuffleRandom itself auto-decodes them.
The relevant lines I quoted from the docs above explain quite
clearly that it's because they are multi-byte formats. Indexing
them is not inefficient, it simply makes no sense. What does it
mean to take the value at index i when it is part of a multi-byte
sequence that continues at index i+1? Auto-decoding has nothing
to do with it.
More information about the Digitalmars-d-learn
mailing list