# Can we randomize strings in systemverilog

**URL:** <https://verificationacademy.com/forums/t/can-we-randomize-strings-in-systemverilog/31984>\
**Category:** SystemVerilog\
**Tags:** Constraint-SystemVerilog, SystemVerilog, Constraint-random-verification\
**Created:** [June 27, 2016, 9:26am UTC](https://verificationacademy.com/forums/t/can-we-randomize-strings-in-systemverilog/31984 "2016-06-27T09:26:09Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Shubhabrata](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/shubhabrata/32/1644_2.png) [@Shubhabrata](https://verificationacademy.com/forums/u/Shubhabrata)\
**Post date:** [August 26, 2022, 4:41am UTC](https://verificationacademy.com/forums/t/can-we-randomize-strings-in-systemverilog/31984/4 "2022-08-26T04:41:50Z")

</div>

_In reply to [sharat](https://verificationacademy.com/forums/t/can-we-randomize-strings-in-systemverilog/31984/3):_

Thanks for this Code. I have one question regarding the array declaration. Over here we have made some conditions upon the numbers which are unsigned themselves. So, do we need to specify  
" unsigned ". Can we not just write -

```verilog
rand byte str [];
constraint condition{str.size <= 50;
                     foreach(str[i])
                       str[i] inside {[65:90], [97:122]};}

```

---

_[View the full topic](https://verificationacademy.com/forums/t/can-we-randomize-strings-in-systemverilog/31984)._
