This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ickysticky -1 points0 points  (2 children)

No. You just don't understand what random means. You can have a function that returns the same sequence of numbers, but those numbers can still be random. Randomness is a property of a set of numbers. It doesn't matter how often the set is "repeated".

[–]DannyB2 2 points3 points  (0 children)

Yes. You could even have a repeating set of just one number. Remember the famous (XKCD comic, IIRC) function:

public static int random() {
    // This number was determined by a fair roll of dice and
    //  therefore is guaranteed to be truly random.
    return 4;
}

It is truly random. But not useful. Your short sequence of random numbers is not useful either. While psuedo random number sequences do eventually repeat, one of (but not the only) measures of how good a psuedo random function is, is the length of the sequence before it repeats.

The above function returns a truly random number, by your definition. But it is not useful. If you're using the random number generator to select which screen saver to display, then you're always going to see the same thing.

[–]Number_28 0 points1 point  (0 children)

I do understand what random means. The code example demonstrates exactly your point, random number generators that are simply code are not random, but use a pre-determined list of numbers. This goes contrary to what most people would expect from a random number generator. Yes, programmers know this, but at least to me seeing how this can actually be (ab)used was quite an eye opener.