Randomization

In reply to Bharathy :

I think you meant the srandom() method, there is no $srandom() function, Both srandom() and set_randstate() can be called on threads or objects. The built-in process class is just another object.

The only place to use set_randstate() is with a value string returned by an earlier get_randstate(). You do this when you need to preserve the RNG from being disturbed by some other operation, like something used for debugging.

...
state = get_randstate();
do_something_else; // want to guarantee that calling this does not disturb the RNG
set_randstate(state);
...

The srandom() method is used when you don’t want to use SystemVerilog’s built-in seeding mechanism