CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   how to call the random function in Fluent (http://www.cfd-online.com/Forums/fluent/33370-how-call-random-function-fluent.html)

Yong April 1, 2004 21:40

how to call the random function in Fluent
 
hello, I don't know how to call random generator in Fluent by using UDF. I found this function in random.h that locate in fluent\src folder. If you know the answer, please reply. Thanks in advance.

ap April 4, 2004 13:19

Re: how to call the random function in Fluent
 
You can use the random generator functions of the C compiler:

The function

randomize();

initializes the random number generator, while the function

random(int n);

generates a random number between 0 and n-1.

Look on google for further details. Here there is an example (if you remove random.html, you have access to a guide to C):

http://www.phanderson.com/C/random.html

Hi :)

ap

ap April 4, 2004 13:21

Re: how to call the random function in Fluent
 
I forgot to say, you need to include stdlib.h

#include <stdlib.h>

and use compiled UDF.

Hi :)

ap

Yong April 6, 2004 03:52

Re: how to call the random function in Fluent
 
Hi, ap, I got it. Thank you very much.


All times are GMT -4. The time now is 16:24.