[Seaside] Generating a random string

Boris Popov, DeepCove Labs boris at deepcovelabs.com
Tue Nov 29 14:49:54 UTC 2011


size := 32.
random := Random new.
String streamContents: [:ws | size timesRepeat: [ws nextPut: (alphabet
atRandom: random)]].




-----Original Message-----
From: seaside-bounces at lists.squeakfoundation.org
[mailto:seaside-bounces at lists.squeakfoundation.org] On Behalf Of Aeren
Sent: Tuesday, November 29, 2011 9:44 AM
To: seaside at lists.squeakfoundation.org
Subject: [Seaside] Generating a random string

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
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) ) ] ].

Any help?

View this message in context:
Sent from the Seaside General mailing list archive at Nabble.com.
seaside mailing list
seaside at lists.squeakfoundation.org

More information about the seaside mailing list