|
-
May 20th, 2004, 02:53 PM
#1
Thread Starter
Frenzied Member
The Strangest Thing...
Look at this code...
VB Code:
'This code will put a random floating point between 0 and 1 in
'the Random property of the member object.
For i = 0 To Group.Count - 1
Randomize()
Dim dbl As Double = ((1 * Rnd()) + 0)
MsgBox(dbl.ToString)
Group.Members(i).Random = dbl
MsgBox(Group.Members(i).Random.ToString)
Next i
'Sanity Check!!! Read the values back in a message box!
Dim strTemp As String = ""
For i = 0 To Group.Count - 1
strTemp &= Group.Members(i).Random.ToString & vbCrLf
Next i
MsgBox(strTemp)
Ahem... Am I going insane, or is there something really wrong with this code?
It seems to me that the values are being put into the object correctly, but when I read it back I get the same floating point back for all of the *different* values...
for instance,
i will get something like the following for the two message boxes in the first loop... I know the numbers aren't right, but u'll get the idea...
.1
.1
.2
.2
.3
.3
.4
.4
and in the last message box i get
.4
.4
.4
.4
What's going on here???
Thanks,
Squirrelly1
Now happily married and still crankin' away at the keyboard.  Life is grand for a coder, no?
-
May 20th, 2004, 09:44 PM
#2
This could be the same issue as mentioned in your other post:
http://www.vbforums.com/showthread.p...hreadid=290793
-
May 20th, 2004, 10:00 PM
#3
Thread Starter
Frenzied Member
Yeah, I determined that afterwards... good 'ol binary reader 
sorry, I should have updated my post 
squirrelly1
Now happily married and still crankin' away at the keyboard.  Life is grand for a coder, no?
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
|