Assuming the generator has been seeded, it is possible to peek at the next random value without changing it?
i.e. given:
#include <stdlib.h>
int r;
r = rand(); // say this is 99
r = rand(); // say this is 80
Is this possible
#include <stdlib.h>
int r;
r = peekAtRand(); // this will give 99
r = rand(); // but this still gives 99
r = peekAtRand(); // this will give 80
r = rand(); // but this still gives 80
Furthermore, can this be extended to peeking at the next n numbers?
Aucun commentaire:
Enregistrer un commentaire