CFD Online Discussion Forums

CFD Online Discussion Forums (
-   FLUENT (
-   -   Random number generator (

ASaidZ April 19, 2010 03:04

Random number generator
Hi all
I am wondering if anyone can help me to use the random number generator to select some cells on a boundary and to give them different boundary condition.

DoHander April 19, 2010 10:57

Here you have an example of how to use the C random number generator:

you can easily adapt this code to your problem.


ASaidZ April 19, 2010 15:41

Thanks a lot for your reply

flames February 3, 2014 21:06


In OF 211, if I use the following random number generator :

scalar Random::scalar01()
return osRandomDouble();

The function osRandomDouble() is defined as:
Foam::scalar Foam::osRandomDouble()
return (scalar)random()/INT_MAX;
return drand48();

Is the radnom number from this generator with zero mean and unity variance? Thanks

All times are GMT -4. The time now is 03:19.