[FIX] CollectionAtRandom [er] [et] [sm]

ducasse at iam.unibe.ch ducasse at iam.unibe.ch
Tue Nov 4 20:07:22 UTC 2003


lukas I just rewrote 

atRandom
	"Answer a random element of the receiver.  Uses a shared random 
	number generator owned by class Collection.  If you use this a lot, 
	define your own instance of Random and use #atRandom:.  Causes 
	an error if self has no elements."

	^Collection mutexForPicking critical: [
		self atRandom: Collection randomForPicking ]
	
	to be 
atRandom
	"Answer a random element of the receiver.  Uses a shared random 
	number generator owned by class Collection.  If you use this a lot, 
	define your own instance of Random and use #atRandom:.  Causes 
	an error if self has no elements."

	^self class mutexForPicking critical: [
		self atRandom: Collection randomForPicking ]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CollectionAtRandom.cs.gz
Type: application/octet-stream
Size: 817 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20031104/60effd72/CollectionAtRandom.cs.obj


More information about the Squeak-dev mailing list