EZ Programing Demos

Slow motion, step by step, animated demonstrations of basic computer programing techniques

Links to topics:

Current topic:

Random lines

This is a lot like ploting random points. So be sure that you understand the following article:


Drawing random line segments entails calculating 4 random coordinates. You need a pair of random coordinates for one endpoint and a second pair of random coordinates for the other endpoint. Run the following demo to see this all work in slow motion. There is more information under the demo.

 Slow  Medium  Fast 
Click 'Run' to go.

We need to find random values for x1, y1, x2, and y2. Then we need to draw a line from (x1, y1) to (x2, y2). Here's a flowchart that shows that logic for this demo:

    Random lines flow chart


In an imaginary computer language, this could look like the following:

    min = -10;
    max = 10;
      x1 = min + rnd() * (max - min);
      y1 = min + rnd() * (max - min);
      x2 = min + rnd() * (max - min);
      x2 = min + rnd() * (max - min);
      line(x1, y1, x2, y2);


Suggested next article:

At EZ Math Movie

EZ Math Movie is a site that can help you experiment with and understand many topics in mathematics. Its main feature is an interactive animated (x, y) graph that you control with an actual programing language. There are many examples and tutorials, and EZ Math Movie is crossed referenced with both EZ Programing Demos and Zona Land Education.


Zona Land Education is a site with explanations and interactive diagrams covering many topics in physics and mathematics. Zona Land Education is cross referenced with EZ Math Movie, and it contains several animations that use EZ Math Movie's programing language.