jeudi 2 août 2018

what is rand algorithem depending on srand and seed?

When I running this code

while ...
 srand (1);
 printf ("Again the first number: %d\n", rand()%100);

on 2 another PC I get diffrent resualts. but in each PC I get always the same random list.

For ex. in PC 1 I always get A , B ,C ,D ,E and in PC2 I always get F, G ,H , I ,J.

I want to know what is the algorithem? If I know the first random , is there any way to know the second random in same PC? .

Second random is depending on seed or only on the last random?




Aucun commentaire:

Enregistrer un commentaire