BEGIN { count = 3000 radius = 500 min_diameter= 1.3 max_diameter= 3 PI = 3.14159259 # initialise the random number generator srand() for ( i = 1; i <= count; i++ ) { # define the object object = "object01" printf( " objectelement { \"eobject%d\" \"%s\"\n", i, object ) # generate random right-ascension and declination values theta = PI*rand() fi = 2*PI*rand() # generate the coordinates x = radius*sin(theta)*cos(fi) y = radius*sin(theta)*sin(fi) z = radius*cos(theta) # place it into the position printf( " loc { (%f %f %f) }\n", x, y, z ) # scale the object scale = min_diameter + (max_diameter - min_diameter)*(rand())^3 printf( " scale { %f }\n", scale ) # close the object element printf( " }\n" ) } }