FAQ Database Discussion Community


Generate random number in range with SecRandomCopyBytes

java,ios,swift,secure-random
I'm using SecRandomCopyBytes for generate a secure random number. Is there a way to specify a "range"? I need to obtain the same behaviour of this Java piece of code: SecureRandom r = new SecureRandom(); char x = (char)(r.nextInt(26) + 'a'); Any tips will appreciate! UPDATE Seeing that I made...