RandomClass

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mia023
    New Member
    • May 2007
    • 89

    #1

    RandomClass

    Does the random class checks if the numbers are duplicate or not with out me implementing the algorithm for checking if duplicate?
  • chaarmann
    Recognized Expert Contributor
    • Nov 2007
    • 785

    #2
    Originally posted by mia023
    Does the random class checks if the numbers are duplicate or not with out me implementing the algorithm for checking if duplicate?
    You can see the answer already in your thread "checkNonDuplic ates".
    If you are in doubt about what I said, read in Internet about the definition of "random", then you can see who is wrong and who is right.

    But to illustrate it to you, just think of throwing a dice many times:
    The numbers returned are random.
    It could be that you throw 6,6,6 one time. Or you throw 1,2,3 another time. All sequences have the same possibility. If some sequences don't, that means if I don't have the possibility to throw 3 times 6, then my dices are not random anymore!

    A computer cannot produce real random numbers, they are all pseudo-random. But they simulate the natural ranomness pretty much, exactly what you need, especially if you "seed" with the current time.
    For example Math.random().

    Comment

    Working...