CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   Random number generator (http://www.cfd-online.com/Forums/fluent/75184-random-number-generator.html)

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.
Thanks
AsaidZ

DoHander April 19, 2010 10:57

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

http://www.cplusplus.com/reference/c.../cstdlib/rand/

you can easily adapt this code to your problem.

Do

ASaidZ April 19, 2010 15:41

Thanks a lot for your reply
AsaidZ

flames February 3, 2014 21:06

Hello,

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()
{
#ifdef USE_RANDOM
return (scalar)random()/INT_MAX;
#else
return drand48();
#endif
}


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


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