RAndomize a Queue in System Verilog

In reply to dave_59:

Thanks a lot Dave.

I have another problem… In the sequence, i want to check the size of the queue . If the size of the queue is not 0, then i want to randomize the queue. Is it possible to achieve this with constraints.

I want something like the following. But this is a randomization error when i try to do this.

constraint queue_val {
     if(my_q.size == 0) {
       my_q.size() inside {[10:20]};
       foreach (my_q[ii]) my_q[ii] >2;
     }
}