--- a/Random.st Sun Sep 08 23:26:41 2019 +0200
+++ b/Random.st Mon Sep 09 18:12:56 2019 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
"
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
@@ -630,6 +632,63 @@
"
!
+nextHumanReadableStringOfSize:length
+ |s canVowel canConsonant followers|
+
+ followers :=
+ #(
+ 'a' "->" 'uibcdfgklmnpqrstvwxz'
+ 'b' "->" 'aeiou'
+ 'c' "->" 'aeioukq'
+ 'd' "->" 'aeiou'
+ 'e' "->" 'uibcdfgklmnpqrstvwxz'
+ 'f' "->" 'aeiou'
+ 'g' "->" 'aeiou'
+ 'h' "->" 'aeiou'
+ 'i' "->" 'bcdfgklmnpqrstvwxz'
+ 'j' "->" 'aeiou'
+ 'k' "->" 'aeiou'
+ 'l' "->" 'aeiou'
+ 'm' "->" 'aeiou'
+ 'n' "->" 'aeiou'
+ 'o' "->" 'uabcdfgklmnpqrstvwxz'
+ 'p' "->" 'aeiou'
+ 'q' "->" 'u'
+ 'r' "->" 'aeiou'
+ 's' "->" 'aeiou'
+ 't' "->" 'aeiouh'
+ 'u' "->" 'ibcdfgklmnpqrstvwxz'
+ 'v' "->" 'aeiou'
+ 'w' "->" 'aeiou'
+ 'x' "->" 'aeiou'
+ 'y' "->" 'aeiou'
+ 'z' "->" 'aeiou'
+ ).
+
+ s := ''.
+ canVowel := canConsonant := true.
+ length timesRepeat:[
+ |chars ch|
+
+ s isEmpty ifTrue:[
+ chars := $a to: $z.
+ ] ifFalse:[
+ chars := followers
+ inGroupsOf:2
+ detect:[:prefix :charSet | s endsWith:prefix ]
+ thenDo:[:prefix :charSet | charSet ]
+ ifNone:[self error].
+ ].
+ ch := chars atRandom.
+ s := s , ch.
+ ].
+ ^ s contents.
+
+ "
+ (1 to:1000) collect:[:n | Random new nextHumanReadableStringOfSize:6 ] as:Bag
+ "
+!
+
nextInteger
"return the next integral random number,
in the range 0 .. self maxInteger"