method
hex
v1_9_3_392 -
Show latest stable
-
0 notes -
Class: SecureRandom
- 1_8_6_287
- 1_8_7_72
- 1_8_7_330
- 1_9_1_378
- 1_9_2_180
- 1_9_3_125 (0)
- 1_9_3_392 (0)
- 2_1_10 (4)
- 2_2_9 (0)
- 2_4_6
- 2_5_5
- 2_6_3
- What's this?
hex(n=nil)
public
SecureRandom.hex generates a random hex string.
The argument n specifies the length of the random length. The length of the result string is twice of n.
If n is not specified, 16 is assumed. It may be larger in future.
The result may contain 0-9 and a-f.
p SecureRandom.hex #=> "eb693ec8252cd630102fd0d0fb7c3485" p SecureRandom.hex #=> "91dc3bfb4de5b11d029d376634589b61"
If secure random number generator is not available, NotImplementedError is raised.