# Dynamic array randomization

**URL:** <https://verificationacademy.com/forums/t/dynamic-array-randomization/35915>\
**Category:** SystemVerilog\
**Tags:** SystemVerilog, constraint, Dynamic-Array, array-sum\
**Created:** [March 29, 2019, 11:53pm UTC](https://verificationacademy.com/forums/t/dynamic-array-randomization/35915 "2019-03-29T23:53:08Z")\
**Posts on this page:** 1\
**Showing post:** 4

<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:** [March 30, 2019, 2:29am UTC](https://verificationacademy.com/forums/t/dynamic-array-randomization/35915/4 "2019-03-30T02:29:36Z")

</div>

_In reply to [sharatk](https://verificationacademy.com/forums/t/dynamic-array-randomization/35915/3):_

> The size of a dynamic array or queue declared as rand or randc can also be constrained. In that case, the array shall be resized according to the size constraint, _and then_ all the array elements shall be randomized

> If an array is constrained by both size constraints and iterative constraints, the size constraints are solved first and the iterative constraints next. As a result of this implicit ordering between size constraints and iterative constraints, _the size method shall be treated as a state variable_ within the foreach block of the corresponding array.

---

_[View the full topic](https://verificationacademy.com/forums/t/dynamic-array-randomization/35915)._
