in reply to Create math homework problems
A quick example: With four elements in @arr, $#arr is 3. rand(3) will return a number >= 0 and < 3. When you truncate the result with int(), you get 0, 1, or 2.
I would have written that line as: $num=int(rand @arr);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Create math homework problems
by t0mas (Priest) on Jan 10, 2001 at 12:29 UTC |