[#68137] improve semantics of manpages — "Anthony J. Bentley" <anthony@...>
Hi,
1 message
2015/02/17
[#68144] Re: Future of test suites for Ruby — Anthony Crumley <anthony.crumley@...>
FYI...
4 messages
2015/02/17
[#68343] [Ruby trunk - Bug #10916] [Open] What the Ruby? SegFault? — ruby@...
Issue #10916 has been reported by why do i need this acct just to create a bug report.
5 messages
2015/02/27
[#68373] Re: [Ruby trunk - Bug #10916] [Open] What the Ruby? SegFault?
— "Martin J. Dürst" <duerst@...>
2015/03/02
> * Author: why do i need this acct just to create a bug report
[#68358] [Ruby trunk - Bug #10902] require("enumerator") scans LOAD_PATH 2x on every invocation — ruby@...1.net
Issue #10902 has been updated by Aman Gupta.
3 messages
2015/02/28
[ruby-core:68104] [Ruby trunk - Feature #10849] Adding an alphanumeric function to SecureRandom
From:
nobu@...
Date:
2015-02-13 02:41:30 UTC
List:
ruby-core #68104
Issue #10849 has been updated by Nobuyoshi Nakada.
> The length of the result string is about 4/3 of _n_.
I don't like this interface.
~~~ruby
def self.choose(source, length)
size = source.size
length.times.map {source[random_number(size)]}.join('')
end
GRAPH = [*'!'..'~']
def self.graph(length)
choose(GRAPH, length)
end
ALPHANUMERIC = [*'A'..'Z', *'a'..'z', *'0'..'9']
# SecureRandom.alphanumeric generates a random alphanumeric string.
#
# The argument _n_ specifies the length of the random number to be
# generated.
#
# The result may contain A-Z, a-z and 0-9.
#
# p SecureRandom.alphanumeric #=> "2BuBuLf3WfSKyQbRccA"
# p SecureRandom.alphanumeric #=> "6BbW0pxO0YENxn38HMUbcQ"
#
# If a secure random number generator is not available,
# +NotImplementedError+ is raised.
def self.alphanumeric(length)
choose(ALPHANUMERIC, length)
end
~~~
----------------------------------------
Feature #10849: Adding an alphanumeric function to SecureRandom
https://bugs.ruby-lang.org/issues/10849#change-51482
* Author: Andrew Butterfield
* Status: Open
* Priority: Normal
* Assignee: Andrew Butterfield
----------------------------------------
It would be handy to have a method that produces a random alphanumeric string.
---Files--------------------------------
securerandom.txt (1.32 KB)
securerandom.patch (1.32 KB)
--
https://bugs.ruby-lang.org/