CFD Online Logo CFD Online URL
Home > Forums > FLUENT

Random Function in UDF per DPM

Register Blogs Members List Search Today's Posts Mark Forums Read

LinkBack Thread Tools Display Modes
Old   May 17, 2006, 04:08
Default Random Function in UDF per DPM
Posts: n/a
Hi users, I need to generate an array of random part_id #. I tried to use c function 'rand()%scalefactor' and 'srand(time(NULL))' but I need number between 1:10,000,000 and rand() returns numbers bw 0:37,***. How doing? THANKS a lot! Adriano
  Reply With Quote

Old   May 18, 2006, 06:19
Default Re: Random Function in UDF per DPM
Posts: n/a
If rand() returns real numbers then you would just have to boost them to the size you want, i.e.

your_random_number = rand() * (10000000.0 / 37.0);

  Reply With Quote


Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Compile problem ivanyao OpenFOAM Running, Solving & CFD 1 October 12, 2012 09:31
channelFoam for a 3D pipe AlmostSurelyRob OpenFOAM 3 June 24, 2011 13:06
ParaView for OF-1.6-ext Chrisi1984 OpenFOAM Installation 0 December 31, 2010 07:42
UDF parse error at profile function line Wiggy Fluent UDF and Scheme Programming 1 July 27, 2009 15:59
Problem with rhoSimpleFoam matteo_gautero OpenFOAM Running, Solving & CFD 0 February 28, 2008 07:51

All times are GMT -4. The time now is 23:34.