On Apr 14, 2009, at 12:26 PM, Luca C. wrote:

Given a seed, rand() will create always the same sequences for that seed.

The same sequence (singular), yes. Each seed generates only one sequence.

But if the seeds changes all the time, you'll always get different
sequences, as it's obvious.

Not necessarily. The requirement is that identical seeds produce identical sequences, but you *can* have different seeds producing the same sequence. The mapping between seeds and sequences need not be one- to-one.

You'll get the same sequences only if you pass
the same seed again, otherwise you'll get some other sequences.

Not necessarily. See above.

In practical use of rand() I have never seen what you're saying, though it's possible. But that doesn't imply that you'll get every time the same
number consequentally in a sequence, that's very rare case if you use
different seeds, very rare.


It depends on the quality of the generator. It is very possible that a given generator would produce the same number N times in a row (for some N) for some seed. Then, if you use that generator again with the same seed, you *will* get those same N numbers in a row at the same point in the generated sequence.

Wagner
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to