Atlassian uses cookies to improve your browsing experience, perform analytics and research, and conduct advertising. Accept all cookies to indicate that you agree to our use of cookies on your device. Atlassian cookies and tracking notice, (opens new window)
Confluence
/
Random numbers (de)

Random numbers (de)

Aug 16, 2019

Zufallszahlen werden in der Programmierung häufig genutzt, sei es nun für das verschlüsseln von Daten oder halt für generative Gestaltung. Processing bietet hier einfache Funktionen:

random([unteres Limit],[oberes Limit])  oder random([0 - oberes Limit])


void setup()
{
  size(500,500);
  background(255);
  fill(255);
  stroke(0);
}
   
void draw()
{
  //fill(random(100,150),random(0,100),random(150,255));
  float size = random(10,100);
  ellipse(random(0,width),random(0,height),size,size);
}


Aufgabe

Erweitere das Beispiel so, dass die Füllfarbe der Ellipse abhängig von der Grösse der Ellipse ist(Durchmesser). Je grösser desto rötlicher soll die Ellipse sein.

, multiple selections available,
For you

Programming
Results will update as you type.
  • Tiling and Repetition
  • Reactors
  • Programming Basics: Parametric and Generative Graphic Design 2016
  • Archive
  • High Scores
  • Artificial Neural Network
  • Alternatives to the Processing IDE
  • p5.js Programming
  • Programming in Processing (java)
    • Starting with Processing (en)
    • Variables (en)
    • Classes and Objects (en)
    • Events und Functions (en)
    • Writing our own Functions (en)
    • Random Numbers (en)
      • Random numbers (de)
    • Conditionals (en)
    • Loops (en)
    • Nested Loops (en)
    • Coordinates (en)
    • Arrays and Lists (en)
    • SVG + Images (en)
    • Motion and Temporality
    • Gesture Interactions
    • Using bitmaps as modifiers
    • Vectors
    • Animation
    • Animation 2
    • Simple Collision Detection
    • Sound
    • Typography

{"serverDuration": 15, "requestCorrelationId": "465c49084b424cbca47a799f5ebbb08c"}