[squeak-dev] The Inbox: Kernel-ul.811.mcz

Levente Uzonyi leves at elte.hu
Mon Sep 23 21:49:51 UTC 2013


On Mon, 23 Sep 2013, commits at source.squeak.org wrote:

> A new version of Kernel was added to project The Inbox:
> http://source.squeak.org/inbox/Kernel-ul.811.mcz
>
>  !Random commentStamp: 'nice 3/24/2010 07:38' prior: 0!
>  This Random Number Generator graciously contributed by David N. Smith.  It is an adaptation of the Park-Miller RNG which uses Floats to avoid the need for LargeInteger arithmetic.
>
>  If you just want a quick random integer, use:
>  		10 atRandom
>  Every integer interval can give a random number:
>  		(6 to: 12) atRandom
>  SequenceableCollections can give randomly selected elements:
>  		'pick one of these letters randomly' atRandom
>  SequenceableCollections also respond to shuffled, as in:
>  		($A to: $Z) shuffled
>
>  The correct way to use class Random is to store one in an instance or class variable:
>  		myGenerator := Random new.
>  Then use it every time you need another number between 0.0 and 1.0 (excluding)
>  		myGenerator next
>  You can also generate a positive integer
>  		myGenerator nextInt: 10!

Is it normal that the class comment is concatenated to the class 
definition, along with its timestamp in chunk format?


Levente


More information about the Squeak-dev mailing list