D
Doctor
I need to generate a random long number. Each team in my software has been
assigned a random number which is used to assign teams to lanes for an event.
But then I must separate teams from the same group so that they are not
competing on adjacent lanes. My code loops through each team. If it finds
teams with the same group ID next to each other, it changes the random
number. To date I have not been able to get the random number to work right.
I either get a number with a decimal, the number 1, or always a positive
number, or always a negative number. So I implemented to code that you see
below for now.
I need my random number to be any number that a long can be.
I sure would appreciate your help. Thanks in advance
****Code****
If intLoopTest < 5 Then
If intNextTeamID > 0 Then
intNewTeamID = intNextTeamID - 434567890
Else
intNewTeamID = intNextTeamID + 434567890
End If
Else
If intNextTeamID > 0 Then 'A long can only be up to
2147,483,648
intNewTeamID = intNextTeamID - 1147483648
Else
intNewTeamID = intNextTeamID + 644245094#
End If
End If
assigned a random number which is used to assign teams to lanes for an event.
But then I must separate teams from the same group so that they are not
competing on adjacent lanes. My code loops through each team. If it finds
teams with the same group ID next to each other, it changes the random
number. To date I have not been able to get the random number to work right.
I either get a number with a decimal, the number 1, or always a positive
number, or always a negative number. So I implemented to code that you see
below for now.
I need my random number to be any number that a long can be.
I sure would appreciate your help. Thanks in advance
****Code****
If intLoopTest < 5 Then
If intNextTeamID > 0 Then
intNewTeamID = intNextTeamID - 434567890
Else
intNewTeamID = intNextTeamID + 434567890
End If
Else
If intNextTeamID > 0 Then 'A long can only be up to
2147,483,648
intNewTeamID = intNextTeamID - 1147483648
Else
intNewTeamID = intNextTeamID + 644245094#
End If
End If