##### Quote

Terry King wrote:

> I Am teaching an "Engineering Design" class to a group of 6th graders

> ISTHERE an available UNIT 'out there' with easy-to-use line graphs

> etc??

hi, here's something i got that might help.

program random1 (input, output); { random1.pas }

{ from adv. turbo pascal, schildt, p. 192, comparison of 3 random

number generators, for my tp 4.0 }

uses crt, graph3;

const count = 1000;

var freq1, freq2, freq3 : array[0..9] of integer;

a1, a2, x, y : integer;

f, f2, f3, r, r2, r3 : real;

procedure display;

var t : integer;

begin

for t := 0 to 9 do

begin

draw(t*10,180,t*10,180-freq1[t],2);

draw(t*10+110,180,t*10+110,180-freq2[t],2);

draw(t*10+220,180,t*10+220,180-freq3[t],2);

end;

end; { end display }

function ran1: real;

var t: real;

begin

t := (a1*32749+3) mod 32749;

a1 := trunc(t);

ran1 := abs(t/32749);

end; { end ran1 }

function ran2: real;

var t: real;

begin

t := (a2*10001+3) mod 17417;

a2 := trunc(t);

ran2 := abs(t/17417);

end; { end ran2 }

begin

graphcolormode;

palette(1); { setup for color graphics w/

palette 1 or 0,1,2,3 }

gotoxy (10,1);

write ('comparison of random');

gotoxy (12,2);

write ('number generators');

draw (0,180,90,180,3);

draw (110,180,200,180,3);

draw (220,180,310,180,3);

gotoxy (5,25);

write ('random ran1 ran2');

a1 := 1; { initialize random generator

variables }

a2 := 203;

f := 0;

f2 := 0;

f3 := 0;

for x := 0 to 9 do

begin { initialize frequency arrays }

freq1[x] := 0;

freq2[x] := 0;

freq3[x] := 0;

end;

for x := 1 to count do

begin

r := random; { get a random number }

f := f + r; { add a computation mean }

y := trunc (r * 10); { convert to integer from 0 t 9 }

freq1[y] := freq1[y] + 1; { increment frequency count }

r2 := ran1;

f2 := f2 + r2;

y := trunc (r2 * 10);

freq2[y] := freq2[y] + 1;

r3 := ran2;

f3 := f3 + r3;

y := trunc (r3 * 10);

freq3[y] := freq3[y] + 1;

display; { graph frequency counts }

end;

readln;

textmode (c80); { return screen to text mode }

writeln ('mean of ramdom is : ',f/count);

writeln ('mean of ran2 is : ',f2/count);

writeln ('mean of ran3 is : ',f3/count);