Luigi said:
Hi all
How can I create a method that returns me a random number between 1 and 20
(extreme included)?
As has been mentioned, you will want to use the Random class. However,
something very important you need to keep in mind: presumably you may
want to choose this random number more than once. If so, you MUST
create a single instance of Random, and reuse it each time you want a
new random number.
If you keep creating new Random instances each time you want a new
random number, you have a very good chance of having several instances
in a row initialized identically, and thus return an identical number.
Pete