Random
Fun with MD5 and Random
By Samuel Montgome... - Posted on October 3rd, 2007
GNU Smalltalk comes with a few fairly nice libraries if you want to generate alphanumeric passwords or salts, and compute MD5 digests, both fairly standard things you might want to do when dealing with storing sensitive data such as passwords.
You can generate some random strings fairly easily using built-in libraries without requiring any packages:
| d i l s |
i := 20.
d := '0123456789abcdefghijklmnopqrstuvwxyz'.
l := d size.
s := String new: i.
1 to: i do: [ :x |
s at: x put: (d at: (Random between: 1 and: l))
].
s printNl!