EZ Programing Demos

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

Links to topics:

Current topic:

Random points

We will combine the math of finding a random number over a range with a repeat loop to plot random points. Be sure you understand these two articles:

Run the demo below. More information is below the demo.

 Slow  Medium  Fast 
Click 'Run' to go.

Here is a basic description of how this program works:

  • Set the value for the variable min. This is the value for the minimum x- or y-coordinate.
  • Set the value for the variable max. This is the value for the maximum x- or y-coordinate.
  • Do the following steps 10 times:
    • Calculate a random x-coordinate between min and max. Set the variable x to this value.
    • Calculate a random y-coordinate between min and max. Set the variable y to this value.
    • Plot a point at (x, y).

 

Following is a flow chart for this program:

 

Here is how the program could look when it is typed out in an imaginary computer language:

    
    min = -10;
    max = 10;
    
    repeat(10)
    {
      x = min + rnd() * (max - min);
      y = min + rnd() * (max - min);
      
      point(x, y);
    }
    

 

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.