[Seaside] Generating a random string

Aeren modesto2005 at gmail.com
Tue Nov 29 14:43:53 UTC 2011


I'm trying to generate a random string, and i've created a method to do so
based on a few things I found on internet. However, when I try to generate
the string, I receive the error : "Improper store into indexable object".
The error comes when I try to insert a new random character into my string.
here is my code.

*randomString:* aSize
	| 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) ) ] ].
	
	^word

Any help?

--
View this message in context: http://forum.world.st/Generating-a-random-string-tp4119392p4119392.html
Sent from the Seaside General mailing list archive at Nabble.com.


More information about the seaside mailing list