View Full Version : simple question about create random data

03 March 2009, 02:18 PM
I want create a dat file with random function (random point3)
and I want the number be big enough : 44 sets and every set have 500 position values
the following is my plan
for i =1 to 44 do
for i=1 to 500 do
random [num,num,num] [num,num,num] --is this enough??

create file --dont know how to realize
write data to the file --dont know how to realize
so much I can think of , need help to full of it
many thanks

03 March 2009, 03:33 PM
try this, if you want your random data float then use a=1.0 b=1000.0

function writeout = (
extfile = createfile "d:/randomdata.dat"
for i= 1 to 44 do (
format "set %\n" i to:extfile
for k=1 to 500 do (
format "% % %\n" (random a b) (random a b) (random a b) to:extfile
format "end set %\n" i to:extfile
format "\n" i to:extfile
close extfile

03 March 2009, 02:08 AM
thanks very much,losbellos
it perform perfect !

CGTalk Moderation
03 March 2009, 02:08 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.