repetition within randomization
- From: "Steve Russell" <srussell@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 2 Dec 2006 00:04:41 -0500
A person on another pc, running my app, reported to me that in some
instances where I call rand( ), there is little or no change. For instance,
I may use
int r = rand( ) % 4;
switch(r)
{
case 0:
// draw a particular emf
break;
case 1:
// draw a particular emf
break;
case 2:
// draw a particular emf
break;
default: // case 3:
// draw a particular emf
break;
}
and get a recurring result that doesn't feel very random. I have
experienced this myself and realize that repetition happens in
randomization. I also have read that my initial call to srand(
GetTickCount() ) does not need to be repeated in a session. I guess I'm
mostly fishing for comments on this situation in which I do not want to
compare previous values as a means to avoid repetition. Is this simply what
I should expect in pseudo-randomization?
.
- Follow-Ups:
- Re: repetition within randomization
- From: Joseph M . Newcomer
- Re: repetition within randomization
- From: Steve Russell
- Re: repetition within randomization
- Prev by Date: Re: callback functions
- Next by Date: Re: No border on dynamically created CListCtrl in W2K (fine on XP)
- Previous by thread: No border on dynamically created CListCtrl in W2K (fine on XP)
- Next by thread: Re: repetition within randomization
- Index(es):
Relevant Pages
|