In sets there can be only Unique nummers. So random produced a few of the same 
numbers. They get excluded from the set.

Tim


> Op 14 jun. 2014 om 11:48 heeft Fabian Boucsein 
> <fabian.boucs...@googlemail.com> het volgende geschreven:
> 
> Hi there,
> 
> i am new to Smalltalk and Pharo and today, while
> trying out some examples, i observed an somewhat
> strange behaviour.
> 
> I used this snippet from the pharo.org website:
> 
> | numbers |
> numbers := Set new.
> 10 timesRepeat: [ numbers add: 100 atRandom ].
> numbers explore.
> 
> Using Pharo 3.0 on my Laptop with Manjaro Linux 32bit and copy
> pasting the snippet above into the workspace i get sometimes
> a set with 10 values, sometimes with 9 values and once a set
> with just 8 values.
> 
> Using this snippet, just to test the timesRepeat message:
> 10 timesRepeat: [ Transcript show: (100 atRandom); cr. ].
> i always get 10 values.
> 
> Is the behaviour with the first snippet correct? Giving sometimes
> 10 or 9 or even 8 values. Or is it a bug? I would expect to always
> get 10 values in my set.
> 
> By the way i am totally excited about your cool programming
> environment. Keep on the good work. I justed started to explore
> it and can say it is awesome to work with. 
> 
> Kind regards,
> Fabian
> 

Reply via email to