cedance
Advanced Member level 2
hi,
i have already asked for generation of random number generation in C language. But i hav a different problem now.
if we use the command srand(unsigned(time(NULL))) its true that i get random numbers generated based on time and so i hav possibility of getting random numbers bettr than if i used srand(some number) or dint use srand function at all.
but, in my program, i have to generate a random number and perform a function and then generate random number immediately after the function gets the value calculated... what happens is, i get the same random number being generated as the time it takes to calculate the function o/p is almost negligible and so the time (NULL) is practically the same value. I need to generate random numbers so rapid and calculate the same function. How can i do that? if not using the inbuilt function in C, cud u suggest me a link or code which does it. i also saw numerical receipes in C but it seems that the random numbers generated r not convincing in the way the o/p is given(as in case of binomial deviates or normal deviates) or its too diffuicult to understand and demands input and user functions to be written(as in the case of adaptive mone-carlo method).
pls suggest me a simple yet good random number generator or help me using the inbuilt function in C itself. thank you.
/cedance
i have already asked for generation of random number generation in C language. But i hav a different problem now.
if we use the command srand(unsigned(time(NULL))) its true that i get random numbers generated based on time and so i hav possibility of getting random numbers bettr than if i used srand(some number) or dint use srand function at all.
but, in my program, i have to generate a random number and perform a function and then generate random number immediately after the function gets the value calculated... what happens is, i get the same random number being generated as the time it takes to calculate the function o/p is almost negligible and so the time (NULL) is practically the same value. I need to generate random numbers so rapid and calculate the same function. How can i do that? if not using the inbuilt function in C, cud u suggest me a link or code which does it. i also saw numerical receipes in C but it seems that the random numbers generated r not convincing in the way the o/p is given(as in case of binomial deviates or normal deviates) or its too diffuicult to understand and demands input and user functions to be written(as in the case of adaptive mone-carlo method).
pls suggest me a simple yet good random number generator or help me using the inbuilt function in C itself. thank you.
/cedance