shuffle a character array

pineapple via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jul 20 09:08:26 PDT 2016


On Wednesday, 20 July 2016 at 16:04:50 UTC, pineapple wrote:
> On Wednesday, 20 July 2016 at 16:03:27 UTC, pineapple wrote:
>> On Wednesday, 20 July 2016 at 13:33:34 UTC, Mike Parker wrote:
>>> There is no auto-decoding going on here, as char[] and 
>>> wchar[] are rejected outright since they are not considered 
>>> random access ranges.
>>
>> They are considered random access ranges by my ranges library, 
>> because they are treated as arrays of characters and not as 
>> unicode strings.
>
> On second thought that's not even relevant - the linked-to 
> module performs an out-of-place shuffle and so does not even 
> require the input range to have random access.

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.


More information about the Digitalmars-d-learn mailing list