Hi, I am looking for some code that will prompt for a number to enter so a random number can be generated from that amount.

Example:

The program run would look like this:

" Please enter the number to pick a random number from: "

Let's say we enter 100, the program should return:

" The random number is 48 "

Then terminate.

Thank you in advance to anyone who can help with this one

Regards,

Jason Marceau

Have you done any research? You realize that the Java API has a Math class with a random() member function that returns a double between 0.0 and 1.0. Once you have that it's a simple matter of multiplying by N to get a random range from 0 to N.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.