Exclude data from $urandom_range

In reply to zz8318:

It would help to ask this as a new question. I’m not sure if your question had any relation to the question above.

You build a list of previously used values in a queue

rand bit [7:0] val;
bit [7:0] list[$];
function void post_randomize;
   list.push_back(val); // if not in a class, just add this line after calling randomize. 
endfunction

Then you can put that list in the constraint

randomize(val) with {!(val inside {8'h2a, 8'h2b, 8'h2c, list}); };

Or you can use a separate constraint

constraint val_not_in_list{ unique {val, list};}