mardi 9 août 2016

c++: Capturing a good seed and reusing it in srand does not get the same result

I am trying to do a ray tracer in c++ and and doing photon mapping by generating x,y,z co-ordinates randomly. Somewhere my program does a seg fault but because of the randomness I am not able to debug the problem using gdb. I logged a run where it does a seg fault and used this:

long int time_op = 1470764845;
    srand(time(&time_op));

But I am not able to recreate the seg fault in gdb. Any idea why?




Aucun commentaire:

Enregistrer un commentaire