Let’s say that you need to generate a random queue of data.
The queue should have:
You can use unique constraints in order to generate unique elements, and you can use foreach to go through all the elements in the queue.
Bonus tip:
If you also need to sort the array you can use post_randomize() and sort().
Another tip:
https://www.edaplayground.com/x/EfLK
You can add a condition when using foreach, like this:
After running the program, you get: