External Exam Download Resources Web Applications Games Recycle Bin

Randoms Loops



Loops


#include "include/colors.inc"

camera {
  location <0, 0, -10>
  look_at <0, 0, 0>
}

light_source { <0, 0, -5> White }

#declare numOfSpheres = 0;

#while (numOfSpheres < 5)
  sphere {< numOfSpheres, 0, 0 >, 1 pigment { Salmon } }
  #declare numOfSpheres = numOfSpheres + 1;
#end


Random Numbers


#include "include/colors.inc"

camera {
  location <0, 0, -10>
  look_at <0, 0, 0>
}

light_source { <0, 0, -5> White }

//now microseconds * 100000 =
//decent seed number
#declare yolo = seed(now * 100000);

//random between 1 and 4:
#declare lol = 4*rand(yolo);

#declare numOfSpheres = 0;

#while (numOfSpheres < lol)
  sphere {< numOfSpheres, 0, 0 >, 1 pigment { Yellow } }
  #declare numOfSpheres = numOfSpheres + 1;
#end


Challenge

Use a loop with random numbers to move, scale and rotate