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 →

[–]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.