Idiomatic way to generate all possible values a static array of ubyte can have

jkpl via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Apr 2 01:20:22 PDT 2016


Let's say I have a ubyte[256]. I want to test all the possible 
values this array can have on a function.

Currently I fill it for each new test with std.random.uniform but 
I'm sure that I loose some time with randomizing and with the 
tests that are repeated. Is there a simple way to do this ? 
Without thinking much, it seems that the loops to generate this 
would be seriously awefull.

By thinking a bit more maybe with a fixed-size big integer it 
would work, since the value could be casted as the right array 
type (as long as its length is power of 2) ?


More information about the Digitalmars-d-learn mailing list