vb.net - random number generator without repetaion -


i new programming. making application in vb.net. want on loading of particular form, random number generated 1 or 2 or 3. when form loaded 2nd time, random number generated 1, 2 or 3 different generated earlier. , when form loaded 3rd time, random number generated 1, 2 or 3 different previous 2 times, i.e. no repetition of random numbers.

for example if on first time form load, random number 3, second time should either 1 or 2. , if second time form load rn 2, third time form load should 1.

i thankful if me in writing code in vb.net.

you can next random list , remove can't picked again.

dim rndlist new list(of integer) {1,2,3} static rnd new random until rndlist.count = 0   'get index random   dim nextvalue integer = rnd.next(0, rndlist.count))   'this value @ index   debug.write(rndlist(nextvalue))   'remove item    rndlist.removeat(nextvalue) loop 

Comments

Popular posts from this blog

java - Andrioid studio start fail: Fatal error initializing 'null' -

android - Gradle sync Error:Configuration with name 'default' not found -

StringGrid issue in Delphi XE8 firemonkey mobile app -