# Random numbers with non repeated values

**URL:** <https://forum.kirupa.com/t/random-numbers-with-non-repeated-values/320681>\
**Category:** programming\
**Created:** [March 30, 2011, 6:54am UTC](https://forum.kirupa.com/t/random-numbers-with-non-repeated-values/320681 "2011-03-30T06:54:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ksach](https://avatars.discourse-cdn.com/v4/letter/k/d78d45/32.png) [@ksach](https://forum.kirupa.com/u/ksach)\
**Post date:** [March 30, 2011, 6:54am UTC](https://forum.kirupa.com/t/random-numbers-with-non-repeated-values/320681/1 "2011-03-30T06:54:51Z")

</div>

Hi

I want to generate random numbers with non repeated values.  
how i can do?  
I used random function as following :  
[SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]Random rnd = new Random();[/COLOR][/SIZE]  
[/COLOR][/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]int i = rnd.Next(1, 5);[/COLOR][/SIZE][/COLOR][/SIZE]

[COLOR=#008000]But its not working. values gets repeated[/COLOR]  
[SIZE=2][COLOR=#008000]  
[/COLOR][/SIZE]Thank you.
