randon number generator inside a function
i've trying to generate a random number inside a function, but to no avail.
I've done the usual
i've tried generating x inside the for loop, with srand outside as well, but to no avail.
void motion( int initial_position, float carrier_position,float x)// equation of motion in 1D. In nm
double bulk_time=100e-12; //carrier decay time in Bulk AlGaAs
double velocity=2e13; // carrier speed in bulk GaAs
x = (float) rand()/RAND_MAX;
for(counter=1;counter<=101;counter++)// 101 steps cover 2000 nm at 2e13 nm/s and 1ps time step
I also tried generating the seed before calling the function in the main program