How can I use $urandom/$random with range?

Is there a way to use $urandom/$random with range?

I succeeded to do it with max range in the following way (in this case 11 is the max range):

temp = (($urandom(9)%11));

But how can I do it for max and min, for example max=11, min =8.

*I can’t use $urandom_range because I have to use different seed from test to test.

In reply to saritr:

The modulus (%) operator gives you the range, so you just increase the range by the minimum value.


temp = ($urandom % (max - min + 1)) + min;

In reply to saritr:
You should be able to use both $urandom or $urandom_range without specifying a seed and let SystemVerilog manage seed generation. You can change the global seeding from test to test by using a command line option. In Questa the option is -sv_seed <arg> where <arg> is random or a specific number.

In reply to dave_59:

I have to use seed because needs of repreduce bugs.
I use ModelSim, not Questa.

In reply to saritr:
You might want to check if Modelsim also supports the -sv_seed option.