Suppose you have an infinite list of random bytes, and you select the first N bytes that correspond to printable ASCII characters. Is this list of N bytes still as secure (e.g. for the purpose of a crypto secret or salt) as accepting all of the bytes (printable ASCII or otherwise)?
I am basically asking whether this code has any cryptographical weakness:
https://github.com/opscode/cookbooks/blob/master/openssl/libraries/secure_password.rb#L26
(Assuming that the output of OpenSSL::Random.random_bytes(1) is indeed random.)