Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I'm trying to write a code that will generate random numbers and no number appears more than onece. Code: -------------------- For I = 0 To 3 For J = 0 To I Do n = Int(4 * Rnd) + 1 'random number generated Array1(I) = n 'random number settled in an array If (I = I - J) Then 'checking for the same place in array numsOK = True Else If Array1(I) = Array1(I - J) Then 'comparing two different places in an array numsOK = False Else numsOK = True End If End If Loop Until numsOK = True Next J 'only the last number and the first one always differ, other numbers repeat -------------------- Next I Plz help me and tell why the program isnt working. I have no idea, how to make it work. -- msburza ------------------------------------------------------------------------ msburza's Profile: http://www.excelforum.com/member.php...o&userid=34222 View this thread: http://www.excelforum.com/showthread...hreadid=539800 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Generate random numbers 1-100 without any repeats? | Excel Worksheet Functions | |||
generating random numbers without repeats | Excel Discussion (Misc queries) | |||
Random Code Generation | Excel Worksheet Functions | |||
Random number generation - with no repeats | Excel Discussion (Misc queries) | |||
Random numbers generation | Excel Programming |