[Seaside] Generating a random string

Bob Arning arning315 at comcast.net
Tue Nov 29 14:49:53 UTC 2011


You don't want the brackets around

[ alphabet at: ( Random between: 1 and: (alphabet
size) ) ]

What you wrote tries to store a block closure into a string. Use 
parentheses instead.

Cheers,
Bob

On 11/29/11 9:43 AM, Aeren wrote:
> 	| alphabet word |
> 	alphabet := '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'.
> 	word := String new: aSize.
> 	1 to: aSize do: [ :position |
> 		word at: position put: [ alphabet at: ( Random between: 1 and: (alphabet
> size) ) ] ].
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20111129/62b5e74f/attachment.htm


More information about the seaside mailing list