[squeak-dev] What is happening here?

Stéphane Rollandin lecteur at zogotounga.net
Mon Apr 4 14:19:59 UTC 2022


Hello all,

I just spent an hour or so chasing a strange glitch in my game, which 
makes a massive usage of Random, and the culprit is as follow:


1) This, as expected, yields a Set of 10 different numbers:

	| b s |

	b := [Random new].
	s := Set new.
	10 timesRepeat: [s add: b value next].
	s


2) This yields a Set of one single number:

	| b s |

	b := [Random new].
	s := Set new.
	10 timesRepeat: [s add: b].
	s collect: [:d | d value next]	


Unless I am missing something, this looks like a pretty serious bug.

Tested in the latest trunk image, on win 64.

Stef


More information about the Squeak-dev mailing list