From c55e75963b731ecedbf18ee786f43d57207cf21f Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Wed, 20 Dec 2017 22:27:25 +0100 Subject: ruby/rand-strings.rb --- ruby/rand-strings.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 ruby/rand-strings.rb (limited to 'ruby/rand-strings.rb') diff --git a/ruby/rand-strings.rb b/ruby/rand-strings.rb new file mode 100644 index 0000000..6552d0b --- /dev/null +++ b/ruby/rand-strings.rb @@ -0,0 +1,11 @@ +#!/usr/bin/env ruby + +s = "" +alphabet = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"] +(0).upto(1000) { + n = Random.rand(10) + w = alphabet.sample(n).join("") + s += w+" " +} +puts s + -- cgit v1.2.3