
-----------------------------------
thomasb
Tue Jan 25, 2011 11:52 am

What should I do to make this
-----------------------------------
How would you make this program:
Write a program to generate 10 random real numbers between:
a.	4 and 5
b.	0 and 10
c.	20 and 30
d.	X any y where x and y are integer inputs



-----------------------------------
Tony
Tue Jan 25, 2011 12:36 pm

RE:What should I do to make this
-----------------------------------
One step at a time.

How would you generate a random (any range) real number? Do that 10 times. Use basic arithmetic operations to transform the range to satisfy a,b,c... which are all just specific cases of d.

-----------------------------------
RandomLetters
Tue Jan 25, 2011 2:18 pm

RE:What should I do to make this
-----------------------------------
dont we have Rand.Int()?

-----------------------------------
Tony
Tue Jan 25, 2011 2:30 pm

RE:What should I do to make this
-----------------------------------
We do! We even have the documentation on how it works and how to use it -- [tdoc]Rand.Int[/tdoc]

-----------------------------------
Raknarg
Thu Feb 17, 2011 8:41 pm

RE:What should I do to make this
-----------------------------------
here, i'll make it simple.

So you have 2 options, which are basically the same thing.

Lets say the variable was x.

1) x := Rand.Int (a, b)

2) randint (x, a, b)

a and b are just the parameters. If you wanted a random number between 1 and 10, you would replace a with 1 and b with 10. 
Either way wont really matter; The only time it would matter is when you have a compund var statement with the same random number like this:

var a, b, c : int := Rand.Int (1, 3)

anyways, hope that helps.
