
random numbers
Hello
I am stuck on a problem from a book I have it asks me to generate random
numbers between 1 and 100 using the following
Math.round(Math.random()*100);
With a sential number to end the sequence
I have no idea how to go about this as the book does not cover it..Can anybody
help me with this

Re: random numbers
The following book contains many basic examples, including the one you are
looking for
"Learn Java by Association with ...", www.techednet.com
"Steve" <khalad@ozemail.com.au> wrote:
>
>Hello
>
>I am stuck on a problem from a book I have it asks me to generate random
>numbers between 1 and 100 using the following
> Math.round(Math.random()*100);
>With a sential number to end the sequence
>
>I have no idea how to go about this as the book does not cover it..Can anybody
>help me with this

Re: random numbers
Hello emtinc,
Why not try and change this line Math.round(Math.random()*100); to Math.round(Math.random()%101);.This
should give you random numbers between less than 101(100 inclusive).
Thanks,
Seun
"emtinc" <emtinc@hotmail.com> wrote:
>
>The following book contains many basic examples, including the one you are
>looking for
>
>"Learn Java by Association with ...", www.techednet.com
>
>"Steve" <khalad@ozemail.com.au> wrote:
>>
>>Hello
>>
>>I am stuck on a problem from a book I have it asks me to generate random
>>numbers between 1 and 100 using the following
>> Math.round(Math.random()*100);
>>With a sential number to end the sequence
>>
>>I have no idea how to go about this as the book does not cover it..Can
anybody
>>help me with this
>