-
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
>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks