# Controlling the random seed for a verification env with UVM

**URL:** <https://verificationacademy.com/forums/t/controlling-the-random-seed-for-a-verification-env-with-uvm/38515>\
**Category:** UVM\
**Tags:** UVM, random-seeds-regression\
**Created:** [December 25, 2020, 11:20pm UTC](https://verificationacademy.com/forums/t/controlling-the-random-seed-for-a-verification-env-with-uvm/38515 "2020-12-25T23:20:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![samerh](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/s/2bfe46/32.png) [@samerh](https://verificationacademy.com/forums/u/samerh)\
**Post date:** [December 25, 2020, 11:20pm UTC](https://verificationacademy.com/forums/t/controlling-the-random-seed-for-a-verification-env-with-uvm/38515/1 "2020-12-25T23:20:47Z")

</div>

I have these questions.

1] how to establish a random seed for a verification env with UVM?

2] what is the difference between using the $srandom(x) system function and passing the seed directly to $random(seed) or $urandom(seed)?

3] how is the seed applied in case using the method randomize()?

---

<div class="post-metadata">

**Author:** ![dave\_59](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/dave_59/32/4499_2.png) [@dave\_59](https://verificationacademy.com/forums/u/dave_59)\
**Post date:** [December 26, 2020, 7:43am UTC](https://verificationacademy.com/forums/t/controlling-the-random-seed-for-a-verification-env-with-uvm/38515/2 "2020-12-26T07:43:36Z")

</div>

_In reply to [samerh](https://verificationacademy.com/forums/t/controlling-the-random-seed-for-a-verification-env-with-uvm/38515):_

1. The seed for SystemVerilog simulation can be set by the command line of your tool. Please check the User Manual.
2. $random is from Verilog and you should no longer be using it.
3. $urandom and randomize are both controlled by the same SystemVerilog seeding mechanism. A good pair on this subject can be found [here](https://s3.amazonaws.com/verificationacademy-news/DVCon2012/Papers/MGC_DVCon_12_UVM_Random_Stability_Don%27t_Leave_it_to_Chance.pdf).

> **[MGC\_DVCon\_12\_UVM\_Random\_Stability\_Don%27t\_Leave\_it\_to\_Chance.pdf](https://s3.amazonaws.com/verificationacademy-news/DVCon2012/Papers/MGC_DVCon_12_UVM_Random_Stability_Don%27t_Leave_it_to_Chance.pdf)**
>
> 589.48 KB
