Skip to content

Commit

Permalink
Partial implementation of Random#bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
jstepien committed Mar 30, 2013
1 parent e42035a commit ffb1670
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions lib-topaz/bootstrap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
load_bootstrap.call("numeric.rb")
load_bootstrap.call("process.rb")
load_bootstrap.call("range.rb")
load_bootstrap.call("random.rb")
load_bootstrap.call("string.rb")
load_bootstrap.call("symbol.rb")
load_bootstrap.call("top_self.rb")
5 changes: 5 additions & 0 deletions lib-topaz/random.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class Random
def bytes(n)
n.times.map { rand(256).chr } .join
end
end
3 changes: 0 additions & 3 deletions spec/tags/core/random/bytes_tags.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
fails:Random#bytes returns a String
fails:Random#bytes returns a String of the length given as argument
fails:Random#bytes returns an ASCII-8BIT String
fails:Random#bytes returns the same output for a given seed
fails:Random#bytes returns the same numeric output for a given seed accross all implementations and platforms
fails:Random#bytes returns the same numeric output for a given huge seed accross all implementations and platforms
fails:Random#bytes returns a random binary String

0 comments on commit ffb1670

Please sign in to comment.