PDA

View Full Version : simple question about create random data


flyingaway
03-29-2009, 03: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

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



function writeout = (
a=1
b=1000
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
)
writeout()

flyingaway
03-30-2009, 03:08 AM
thanks very much,losbellos
it perform perfect !

CGTalk Moderation
03-30-2009, 03: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.