CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

how to generate random number?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 5, 2006, 01:06
Default how to generate random number?
  #1
ztdep
Guest
 
Posts: n/a
Hi;

i want to use a series a random number between 0 and 20, what should i do ? regards
  Reply With Quote

Old   May 5, 2006, 03:38
Default Re: how to generate random number?
  #2
ganesh
Guest
 
Posts: n/a
Dear ztdep,

You can look out for a lot of random number generators available on net. A simple option could be to use the 'rand()' command in MATLAB. For eg: rand(1) generates a random number between 0 and 1. Since you need the number between 0 and 20, all you need to do is use rand(1).*20, which would generate a random number in [0,20]. Note that all random number generators are pseudo-random, and there is nothing deterministic about multiplying the random number by 20. Hope this helps

Regards,

Ganesh
  Reply With Quote

Old   May 5, 2006, 04:28
Default Re: how to generate random number?
  #3
ztdep
Guest
 
Posts: n/a
Thank you very much! so what is the meaning of the pseudo-random? regards
  Reply With Quote

Old   May 5, 2006, 06:31
Default Re: how to generate random number?
  #4
ganesh
Guest
 
Posts: n/a
Dear ztdep,

Though we make use of a random number generator, it works on an underlying algorithm, which brings in an element of determinism. Therefore, these generators are referred to as pseudo-random, mening they are random generators, but do have an element of determinism owing to an underlying algorithm.

Regards,

Ganesh
  Reply With Quote

Old   May 6, 2006, 06:53
Default Re: how to generate random number?
  #5
vijesh joshi
Guest
 
Posts: n/a
Hello friends, I saw this message. I am with a question. Why do we need random numbers? What is its relation with CFD? Regards, VVJ.
  Reply With Quote

Old   May 6, 2006, 08:52
Default Re: how to generate random number?
  #6
ganesh
Guest
 
Posts: n/a
Dear Vijesh,

There are many applications for random number generators in various fields. In CFD, may be their use is not too much, however one which comes to my mind is for use in random perturbation of grid points, to study effect of grid distortions on accuracy, scheme stability etc ...

Regards,

Ganesh

  Reply With Quote

Old   May 8, 2006, 07:20
Default Re: how to generate random number?
  #7
ztdep
Guest
 
Posts: n/a
Hi:

i use it to generate a random heat source so as to validate my reduced order model !

regards
  Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
mesh file for flow over a circular cylinder Ardalan Main CFD Forum 7 December 15, 2020 14:06
[mesh manipulation] Mesh Refinement Luiz Eduardo Bittencourt Sampaio (Sampaio) OpenFOAM Meshing & Mesh Conversion 42 January 8, 2017 13:55
Upgraded from Karmic Koala 9.10 to Lucid Lynx10.04.3 bookie56 OpenFOAM Installation 8 August 13, 2011 05:03
Smooth Grid Error! Help seasoul FLUENT 1 March 24, 2008 11:56
-- gaussian random number -- rana FLUENT 0 November 18, 2007 23:06


All times are GMT -4. The time now is 14:36.