I want to write a method named random.
Description: suppose i have 10 number in hand. when i run my program the number will display randomly. but there must not be any repeatation. (number 10 is urbitary)
Please help me to write the method or class
8 replies to this topic
#1
Posted 14 June 2011 - 03:10 AM
|
|
|
#2
Posted 14 June 2011 - 03:21 AM
If you store the numbers in a list, then you can remove them from the list as they are found. It will need to be part of a class to store the numbers in the list, of course.
#3
Posted 14 June 2011 - 06:03 AM
As far as generating your numbers, you can use the Math.random method or the java.util.Random class.
#4
Posted 14 June 2011 - 08:01 AM
I am thinking about to create a class/method/package. I dont want to use any existing function.
#5
Posted 14 June 2011 - 12:30 PM
At some point, you will need to generate a random number bounded by the number of available numbers. You really shouldn't roll your own random number generator.
#6
Posted 14 June 2011 - 10:29 PM
Sorry sir, could not understand meaning. please write in easy english.
WingedPanther said:
At some point, you will need to generate a random number bounded by the number of available numbers. You really shouldn't roll your own random number generator.
#7
Posted 15 June 2011 - 02:31 AM
What I mean is that you will have to use a random number generator someplace in your algorithm. You have a choice, use the one in the library, or try to make your own. Unfortunately, making your own that works well is not easy, and is not a good idea.
#8
Posted 15 June 2011 - 11:26 AM
To get an idea of what goes into a PRNG (pseudo random number generator), you can check out the source code of the SIMD-Oriented Fast Mersenne Twister.
Wow I changed my sig!
#9
Posted 17 June 2011 - 02:46 AM
or How We Learned to Cheat at Online Poker: A Study in Software Security - Developer.com
lots of useful information about pseudo random number generator.
lots of useful information about pseudo random number generator.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









