jeudi 7 avril 2016

Is it a good idea to try and use the entire rand() table?

I'm currently using this code to randomise some variables.

srand(time(NULL));
do{vkmhrand = rand ();vkmh = vkmhrand/78;}while(vkmh <= 0 || vkmh > vmax);

vmax won't exceed 415, which means that if I make it as simple as vkmh = rand() the majority of the randomized table will be discarded, plus I also get some nice decimals to make the results a little more interesting.

I know rand()'s not the best random function to use in existence. I'm just thinking in general, is it a good idea to try and use as much of the table as possible? Is it a waste of time? Or does it exacerbate any patterns that might already exist in the table?




Aucun commentaire:

Enregistrer un commentaire