shuffle a character array

Mike Parker via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jul 20 06:33:34 PDT 2016


On Wednesday, 20 July 2016 at 10:40:04 UTC, pineapple wrote:
> On Wednesday, 20 July 2016 at 08:02:07 UTC, Mike Parker wrote:
>> You can then go to the documentation for 
>> std.range.primitives.isRandomAccessRange [2], where you'll 
>> find the following:
>>
>> "Although char[] and wchar[] (as well as their qualified 
>> versions including string and wstring) are arrays, 
>> isRandomAccessRange yields false for them because they use 
>> variable-length encodings (UTF-8 and UTF-16 respectively). 
>> These types are bidirectional ranges only."
>
> There's also the shuffle module in mach.range which doesn't do 
> any auto-decoding: 
> https://github.com/pineapplemachine/mach.d/blob/master/mach/range/random/shuffle.d

There is no auto-decoding going on here, as char[] and wchar[] 
are rejected outright since they are not considered random access 
ranges.


More information about the Digitalmars-d-learn mailing list