CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT

Random Function in UDF per DPM

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 17, 2006, 05:08
Default Random Function in UDF per DPM
  #1
adriano
Guest
 
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, 07:19
Default Re: Random Function in UDF per DPM
  #2
HS
Guest
 
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);

/Henrik
  Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
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 10:31
channelFoam for a 3D pipe AlmostSurelyRob OpenFOAM 3 June 24, 2011 14: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 16: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 02:40.