I wanted to fill an array with random numbers (i use cuRand), but what a surprise when i noticed that although being aparently random, every time that i run the code there they are, allways the same numbers (not so random). I proceeded to check my seed, and i received allways the same value wich was 1462615827. I tried to make it unsigned and i receive the exact same value. What could possibly happen in this idilic code?
unsigned long seed1 = unsigned(time(NULL));
long seed2 = time(NULL);
printf("%lu\n", seed1);
printf("%ld\n", seed2);
//The same number is printed
Aucun commentaire:
Enregistrer un commentaire