Skip to content
ExamplesOpen editor ↗

paloEpe

→ random()

Returns a number you cannot know in advance — a different one each time.

paloEpe(kwaTlase, kwaGodimo)

Given nothing, paloEpe() returns a number between 0 and 1. 0 can come up; 1 never does.

Given one number, it returns a number between 0 and that number — paloEpe(400) returns any number from 0 up to 400.

Given two numbers, it returns a number between them — paloEpe(100, 300).

Given a list, it does not return a number — it returns one item taken out of the list. This is the usual way to pick a colour or a shape.

The value differs every time the sketch runs. When you want to see the same thing again and again, use paloEpePeo.

NameTypeDescription
kwaTlase (optional)paloThe lower bound, which is included. When only one number is given it acts as the upper bound and the lower bound is 0. A list may be given instead of numbers — then one item out of it is returned.
kwaGodimo (optional)paloThe upper bound, which is not included.
Circles scattered across the canvas
tiro setaLoeto() {
  thalaKanefase(400, 400);
  bokamorago(18, 22, 40);
  tlogelaMothalo();

  gopheta (diri i = 0; i < 120; i = i + 1) {
    diri x = paloEpe(bophara);
    diri y = paloEpe(boleele);
    diri bogolwane = paloEpe(6, 34);

    tlatsaMmala(paloEpe(120, 255), paloEpe(80, 200), paloEpe(150, 255));
    thalaSediko(x, y, bogolwane);
  }
}
Picking a colour out of a list
tiro setaLoeto() {
  thalaKanefase(400, 400);
  bokamorago(240);
  tlogelaMothalo();

  metlha mebala = [
    [220, 80, 60],
    [40, 140, 200],
    [250, 190, 60]
  ];

  gopheta (diri i = 0; i < 8; i = i + 1) {
    gopheta (diri j = 0; j < 8; j = j + 1) {
      metlha mmala = paloEpe(mebala);
      tlatsaMmala(mmala[0], mmala[1], mmala[2]);
      thalaKhutlonne(i * 50, j * 50, 50, 50);
    }
  }
}

paloEpePeo, paloEpeGauss, paloKelelo, lekanyetsa