[squeak-dev] The Trunk: Kernel-ul.908.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Feb 26 21:10:30 UTC 2015

Levente Uzonyi uploaded a new version of Kernel to project The Trunk:

==================== Summary ====================

Name: Kernel-ul.908
Author: ul
Time: 26 February 2015, 10:09:05.384 pm
UUID: 89028aae-a08b-4320-9c55-53b1036a5192
Ancestors: Kernel-ul.907

Removed the unused variables from Random.

=============== Diff against Kernel-ul.907 ===============

Item was changed:
  Object subclass: #Random
+ 	instanceVariableNames: 'states index'
+ 	classVariableNames: 'MTa MTbShifted MTcShifted MTl MTlowerMask MTm MTn MTs MTt MTu MTupperMask MTw MTwFloatMultiplier MTwordMask'
- 	instanceVariableNames: 'states index seed'
- 	classVariableNames: 'A M MTa MTbShifted MTcShifted MTl MTlowerMask MTm MTn MTs MTt MTu MTupperMask MTw MTwFloatMultiplier MTwordMask Q R'
  	poolDictionaries: ''
  	category: 'Kernel-Numbers'!
  !Random commentStamp: 'ul 2/20/2015 09:44' prior: 0!
  I implement the 32-bit version of the Mersenne Twister PRNG, using 30-bit arithmetic, based on http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/ARTICLES/mt.pdf . The parameters of the generator are stored in class variables prefixed with MT.
  Instance Variables
  	states:	<Array>
  	index: <Integer>
  	- the index of the state, which should be used to generate the next random integer value
  	- an Array holding the internal state of the generator
  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!

More information about the Squeak-dev mailing list