Jump to content

Randomization a few used values with dist


ryz

Recommended Posts

Is there any good way of doing an distributed randomization with dist for a few values that I know will be used and a lot of other values that could be good to test.

I have a field that can take the value 0-511 where the values 63, 127, 255 and 511 will be used in the product but the other values should work. I therefore want to specify that the values 63, 127, 255 and 511 should be generated much more often then other values. What I have come up with is.

1)

top_seg_cfg_length dist {
    63:=4,
    127:=4,
    255:=4,
    511:=4,
    [0:62]    :/ 1,
    [64:126]  :/ 1,
    [128:254] :/ 1,
    [256:510] :/ 1
    };

which I think is ugly and a lot of unnecessary code. What I really would like to specify is

2)

top_seg_cfg_length dist {
    63:=4,
    127:=4,
    255:=4,
    511:=4,
    others    :/ 1,
    };

What will be the result if I would write

3)

top_seg_cfg_length dist {
    63:=4,
    127:=4,
    255:=4,
    511:=4,
    [0:511]   :/ 1,
    };
Link to comment
Share on other sites

3) should of course have been

top_seg_cfg_length dist {

63:=1,

127:=1,

255:=1,

511:=1,

[0:511] :/ 1,

};

to much copy and paste.

The problem with this is that other constrains can affect the distribution quite a lot. lets say we have the constrain

x dist {[0:3]:=1, [0:511]\=1} and then in some test case adds the constrains x < 5; That will boost the probability for [0:3] quite a lot. This would not be a problem with an others clause. In my case this is not a problem and I might never have any problem with it but it is something you have to keep in mind.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...