Let’s say that you need to generate a random queue of data.
The queue should have:
- 10 elements
- values between 1 and 100
- each element is an even number
- each element is unique
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.
If you also need to sort the array you can use post_randomize() and sort().
You can add a condition when using foreach, like this:
After running the program, you get: