Experiments

Andrew C. Greenberg werdna at gate.net
Wed Feb 17 12:45:42 UTC 1999


> 4. Random doesn't behave as expected.
> I just left the babbler running. When it wants to build a conversation, it
> gets suitable morphs, chooses one atRandom, and then sorts the rest by
> distance to the first, grabs the first 5 atRandom and those will 
> talk together
> (hint: no shouting all over the world). Then, the conversation is 
> built with its
> members and a list of events taken from text lists again atRandom. The color
> of the conversation will also be Color random.
>
> Then you'll see waves of the same color, waves of the same text, waves of
> the same amount of morphs talking and waves of the same morphs 
> talking. ???...
>
> I also noticed this with Color random doing something else. I built a
> function plotter and at first I chose the color of each function by 
> Color random
> as they were added. I noticed pairs and triplets of very similar 
> colors chosen
> consecutively.


I found random to work pretty well.


Did you by any chance filein the Random bits from the STP goodies? 
The substitute collection-picker code there was buggy (at least a rev 
or two ago), using calls to "Random new next" in the message for 
picking random elements from a SequenceableCollection.

The problem with this, of course, is that each call to "Random new" 
simply creates up a new GENERATOR with a non pseudo-random seed, 
instead of generating a new pseudo- from an existing generator state. 
Thus, subsequent calls to, "atRandom" yielded the same results (or, 
depending how the code is written, bands of results).

If you replace the calls to "Random new" with calls to 
"RandomForPicking", an rng resident in Smalltalk, those messages will 
work properly.





More information about the Squeak-dev mailing list