Archives of the TeradataForum
Message Posted: Mon, 08 Jul 2002 @ 21:32:53 GMT
Do you really need a random number or are you just trying to maximize the distribution of data across the AMPs? I'm asking this because when I began my career (a long time ago), I did some R&D on analog-to-digital psuedo-random number generators (RNGs).
Given any random value, then by definition any bit (or combination of bits) is random. In other words, if I look at the 3 least- significant bits of a random value, they should be as random as the 3 most-significant bits. Attempting to increase randomness by performing arithmetic on the random value (such as multiplying the value by pi) does nothing to improve randomness (and if you're not careful with the arithmetic, you can actually compromise the randomness).
If we take my example of the 3 least-significant bits, the values can range from 0 to 7. Randomness does not necessarily guarantee that the values generated won't be sequential. So in one case, the RNG can generate the string of 0, 7, 5, 2, 3, 6, 4, 1. In the next case, you're at risk that the RNG might generate 0, 1, 2, 3, 4, 5, 6, 7.
Increasing the width of the random value (the number of bits) minimizes the likelihood that a string of random values will be sequential, but doesn't guarantee that it won't happen. (I should mention that the purpose of increasing the width of the random value is not to minimize sequential strings, but it is a side-effect).
So here's my point: If you can accept the possibility that you might actually end-up with a sequential sequence from the RNG, then why not simply use a sequential value in the first place and skip the complications of using a random number generator? There's no simpler way of guaranteeing that you won't see a duplicate than by using a sequential value.
So do you really need the random number?
|Copyright 2016 - All Rights Reserved|
|Last Modified: 27 Dec 2016|