Why we are suggested to use $urandom rather than $random

I go through the LRM and still do not understand exactly why we say “$urandom has a better random-stability than $random” while both of the two functions can generate random values according to the “seed” argument

In reply to jianfeng.he:

Actually, in our code most of the time, we deal with positive integers.
$random might get you a negative number. But $urandom won’t because it’s unsigned.
That’s why we prefer $urandom.

In reply to Shubhabrata:

In reply to jianfeng.he:
Actually, in our code most of the time, we deal with positive integers.
$random might get you a negative number. But $urandom won’t because it’s unsigned.
That’s why we prefer $urandom.

This is really a difference between $random and $urandom, but I guess there are some other differences in random-stability, I did a little test and found that $random did not affect the random results of subsequent codes, I want to know why, thanks!

code: Edit code - EDA Playground

In reply to jianfeng.he:

Yes, the main reason not to use $random is it does not have the random stability properties of $urandom, randomize() and other SystemVerilog randomization constructs. You must manually control the seeding.

Another problem with $random is its distribution is not uniform across every bit. It uses a very old and simple randomization algorithm that is prescribed by the LRM.

And finally, the seeding of $random and all SystemVerilog randomization constructs can be controlled by the command line to run different seeds without having to modify your code.

In reply to dave_59:

In reply to jianfeng.he:
Yes, the main reason not to use $random is it does not have the random stability properties of $urandom, randomize() and other SystemVerilog randomization constructs. You must manually control the seeding.

BTW, how to control the seeding manually in a process? I can only get the string of rand state of current process by calling get_randstate() function, however the “seed” argument of $random/$urandom is int.