|
-
May 14th, 2006, 01:20 PM
#1
Thread Starter
New Member
even odd random numbers
I have an application that calls a series of 75 numbers without replication. That works fine. I have a need to at times limit the sequence to either even or odd numbers that fall within the range of 1 to 75. These numbers will be referred to sequentially later so they must be written into the fields on the form in the order they are selected.
I can get the code to recognize whether the number is odd or even but it ends up writing them in the sequence they were originally drawn in on the complete 75 number set.
I would like the even number selection to write a 37 number set in theqence C1 through C37 and the odd number selection write a 38 number set in sequence C1 Through C38.
Which set is selected is will be dependant on a field that is checked to indicate which set is desired.
Any help would be appreciated.
Dim i(75) As Integer
Dim Nxt As Integer, Nxt2 As Integer
Randomize
Nxt = 1
Do Until Nxt = 76
redo:
Nxt2 = 1
i(Nxt) = Int((75 - 1 + 1) * Rnd + 1)
Do Until Nxt2 = Nxt
If i(Nxt) = i(Nxt2) Then GoTo redo
Nxt2 = Nxt2 + 1
Loop
Nxt = Nxt + 1
Loop
If Me![C1] Mod 2 = 0 Then
Exit Sub
End If
Me![C1] = i(1)
Me![C2] = i(2)
Me![C3] = i(3)
Me![C4] = i(4)
Me![C5] = i(5)
Me![C6] = i(6)
Me![C7] = i(7)
Me![C8] = i(8)
Me![C9] = i(9)
Me![C10] = i(10)
Me![C11] = i(11)
Me![C12] = i(12)
Me![C13] = i(13)
Me![C14] = i(14)
Me![C15] = i(15)
Me![C16] = i(16)
Me![C17] = i(17)
Me![C18] = i(18)
Me![C19] = i(19)
Me![C20] = i(20)
Me![C21] = i(21)
Me![C22] = i(22)
Me![C23] = i(23)
Me![C24] = i(24)
Me![C25] = i(25)
Me![C26] = i(26)
Me![C27] = i(27)
Me![C28] = i(28)
Me![C29] = i(29)
Me![C30] = i(30)
Me![C31] = i(31)
Me![C32] = i(32)
Me![C33] = i(33)
Me![C34] = i(34)
Me![C35] = i(35)
Me![C36] = i(36)
Me![C37] = i(37)
Me![C38] = i(38)
Me![C39] = i(39)
Me![C40] = i(40)
Me![C41] = i(41)
Me![C42] = i(42)
Me![C43] = i(43)
Me![C44] = i(44)
Me![C45] = i(45)
Me![C46] = i(46)
Me![C47] = i(47)
Me![C48] = i(48)
Me![C49] = i(49)
Me![C50] = i(50)
Me![C51] = i(51)
Me![C52] = i(52)
Me![C53] = i(53)
Me![C54] = i(54)
Me![C55] = i(55)
Me![C56] = i(56)
Me![C57] = i(57)
Me![C58] = i(58)
Me![C59] = i(59)
Me![C60] = i(60)
Me![C61] = i(61)
Me![C62] = i(62)
Me![C63] = i(63)
Me![C64] = i(64)
Me![C65] = i(65)
Me![C66] = i(66)
Me![C67] = i(67)
Me![C68] = i(68)
Me![C69] = i(69)
Me![C70] = i(70)
Me![C71] = i(71)
Me![C72] = i(72)
Me![C73] = i(73)
Me![C74] = i(74)
Me![C75] = i(75)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|