I am having issue with not having proper distribution for below code.
int success = std::randomize(cmd_err) with { cmd_err dist { NO_CMD_ERR := 1, {R_CRC,R_TIMEOUT,R_START,R_TRANS,R_END} := 5}; };
I always get NO_CMD_ERR irrespective of weightage. My intent is to have more errors compared to no error.
Am I missing something ?
thanks
In reply to Andee:
What you have written is a concatenation of error values, not list of error values. If cmd_err is an enumeration, you implicitly get an even distribution of enum values; So NO_CMD_ERR should appear 1/6 of the time. But you could write
(cmd_err == NO_CMD_ERR) dist {1:=1, 0:=24}
which say NO_CMD_ERR should appear 1/25 of the time.