ryz Posted December 5, 2011 Report Posted December 5, 2011 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, }; Quote
dave_59 Posted December 5, 2011 Report Posted December 5, 2011 You should use 3). Then the weight of 63, 127, 255, and 511 will be (4 + (1/512))/17= 0.2354. The weight of 'others' will be (1/512)/17 = 1/8704 = 0.0001 Quote
ryz Posted December 6, 2011 Author Report Posted December 6, 2011 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. Quote
Recommended Posts
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.