# generating keys by using only part of longer random number

Hi,
If I have a random number generator that e.g. generates 512bit long
keys but I only need 160bits of them. Would the quality of the
randomness then be compromised if I always just uses the first 160bits
of the key?

My feeling is that it should not make it less random if you look at it
from a statistically perspective.

Example using digits for simplicity (3 digit random string S, 3 digit
key K needed):

S=12345
K=123

getting K=123 happens for S=12300 to S=12399
This is 100 times in 100000 draws = once every 1000 draws.
if S was only 3 digits long it would get K=123 only once in 1000 draws
= statistically the same as above.

But is my statistically approach to this correct when working with
cryptography?

.

## Relevant Pages

• New, state-of-the-art random number generator: simple, strong and fast
... small and high dimensions) is the decimals of Pi. ... character being superior to most algorithms currently implemented ... for a new random number generator, ... to use the digits of a number defined by formula, ...
(sci.stat.math)
• New, state-of-the-art random number generator: simple, strong and fast
... small and high dimensions) is the decimals of Pi. ... character being superior to most algorithms currently implemented ... for a new random number generator, ... to use the digits of a number defined by formula, ...
(sci.math)
• Re: Is this secure?
... I need to generate passwords and I think that pseudo-random generator is ... FIVE character lowercase password with no digits, ... lowercase letters, plus digits, plus punctuation, than a four digit ... password taken from lowercase letters only. ...
(comp.lang.python)
• Re: random number generation & predictability
... >If I have a generator of places of pi, ... and then starts computing digits of pi. ... it matches your sequence of digits, and then I'll do just fine predicting ... What you want is a program that runs fast even with fairly large seeds ...
(comp.theory)
• Re: PRNG
... Generator algorithm on a computer that lacks infinite memory. ... You can only calculate the first N digits of Pi, ...
(sci.crypt)