# Interview question on constraint

**URL:** <https://verificationacademy.com/forums/t/interview-question-on-constraint/39755>\
**Category:** SystemVerilog\
**Tags:** uvm-sv-constraints, SystemVerilog, constraints\
**Created:** [October 27, 2021, 5:58pm UTC](https://verificationacademy.com/forums/t/interview-question-on-constraint/39755 "2021-10-27T17:58:19Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![iamyash1234](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/i/67e7ee/32.png) [@iamyash1234](https://verificationacademy.com/forums/u/iamyash1234)\
**Post date:** [November 29, 2021, 5:28am UTC](https://verificationacademy.com/forums/t/interview-question-on-constraint/39755/9 "2021-11-29T05:28:14Z")

</div>

_In reply to [Alokpati](https://verificationacademy.com/forums/t/interview-question-on-constraint/39755/8):_

HI,  
Yes you are right.,  
but we can do like below.,

function void post\_randomize();  
int i=$urandom\_range(0,8);  
array[i]=array[i+1];  
endfunction

though itseems everytime alternate index will be having same values,that’s fine as the main context is to have same value in any two different indexes.

---

_[View the full topic](https://verificationacademy.com/forums/t/interview-question-on-constraint/39755)._
