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

2016-04-02 Thread jkpl via Digitalmars-d-learn
On Saturday, 2 April 2016 at 18:32:03 UTC, Steven Schveighoffer wrote: I honestly think you are better off just generating random arrays, even if it results in some overlap (unlikely to be relevant). -Steve Yes I know, I've realized how it's silly. just foreach(xn; 0 .. range) foreach(xn;

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

2016-04-02 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/2/16 5:47 AM, jkpl wrote: gives: core.exception.OutOfMemoryError@src/core/exception.d(693): Memory allocation failed Probably because randomCover needs to allocate a bool for all the elements it has already covered, so you are allocating 32 * 4G bools. How much RAM do you have? Note

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

2016-04-02 Thread Ali Çehreli via Digitalmars-d-learn
[Probably a repost.] On 04/02/2016 01:20 AM, jkpl wrote: Let's say I have a ubyte[256]. I want to test all the possible values this array can have on a function. nextPermutation(): https://dlang.org/phobos/std_algorithm_sorting.html#nextPermutation Ali

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

2016-04-02 Thread jkpl via Digitalmars-d-learn
gives: core.exception.OutOfMemoryError@src/core/exception.d(693): Memory allocation failed

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

2016-04-02 Thread jkpl via Digitalmars-d-learn
On Saturday, 2 April 2016 at 09:11:34 UTC, jkpl wrote: On Saturday, 2 April 2016 at 08:48:10 UTC, rikki cattermole wrote: On 02/04/2016 9:36 PM, jkpl wrote: On Saturday, 2 April 2016 at 08:27:07 UTC, rikki cattermole wrote: Okay that is a problem then. Yes clearly! Maybe this, a bit

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

2016-04-02 Thread jkpl via Digitalmars-d-learn
On Saturday, 2 April 2016 at 08:48:10 UTC, rikki cattermole wrote: On 02/04/2016 9:36 PM, jkpl wrote: On Saturday, 2 April 2016 at 08:27:07 UTC, rikki cattermole wrote: Okay that is a problem then. Yes clearly! Maybe this, a bit better: foreach (b0; randomCover(iota(0,256)))

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

2016-04-02 Thread rikki cattermole via Digitalmars-d-learn
On 02/04/2016 9:36 PM, jkpl wrote: On Saturday, 2 April 2016 at 08:27:07 UTC, rikki cattermole wrote: On 02/04/2016 9:20 PM, jkpl wrote: Let's say I have a ubyte[256]. I want to test all the possible values this array can have on a function. Actually I'd use a hex string. So: static

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

2016-04-02 Thread jkpl via Digitalmars-d-learn
On Saturday, 2 April 2016 at 08:27:07 UTC, rikki cattermole wrote: On 02/04/2016 9:20 PM, jkpl wrote: Let's say I have a ubyte[256]. I want to test all the possible values this array can have on a function. Actually I'd use a hex string. So: static ubyte[256] DATA = cast(ubyte[256])x"00 01

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

2016-04-02 Thread rikki cattermole via Digitalmars-d-learn
On 02/04/2016 9:20 PM, jkpl wrote: 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

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

2016-04-02 Thread jkpl via Digitalmars-d-learn
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 ?