How to generate an array of unique random values

Nowadays in many verification scenarios, it requires to create a set of random instructions or addresses with each unique value or we can say that no repeating values, usually represented as elements in a dynamic array.  Earlier versions of SystemVerilog required you to use either nested foreach loops to constraint all combinations of array elements…