lib/random/formatter.rb in securerandom-0.3.0 vs lib/random/formatter.rb in securerandom-0.3.1

- old
+ new

@@ -199,13 +199,12 @@ # records, which may have a significant performance benefit compared to random # data inserts. # # The result contains 74 random bits (9.25 random bytes). # - # Note that this method cannot be made reproducable with Kernel#srand, which - # can only affect the random bits. The sorted bits will still be based on - # Process.clock_gettime. + # Note that this method cannot be made reproducable because its output + # includes not only random bits but also timestamp. # # See draft-ietf-uuidrev-rfc4122bis[https://datatracker.ietf.org/doc/draft-ietf-uuidrev-rfc4122bis/] # for details of UUIDv7. # # ==== Monotonicity @@ -291,10 +290,11 @@ else raise ArgumentError, "extra_timestamp_bits must be in 0..12" end end + # Internal interface to Random; Generate random data _n_ bytes. private def gen_random(n) self.bytes(n) end # Generate a string that randomly draws from a @@ -338,10 +338,12 @@ result.concat source.values_at(*is).join('') end result end + # The default character list for #alphanumeric. ALPHANUMERIC = [*'A'..'Z', *'a'..'z', *'0'..'9'] + # Generate a random alphanumeric string. # # The argument _n_ specifies the length, in characters, of the alphanumeric # string to be generated. # The argument _chars_ specifies the character list which the result is