j
: Next unread message k
: Previous unread message j a
: Jump to all threads
j l
: Jump to MailingList overview
Oops there was a typo in my suggested Set::AtRandom
Here's the one I'm actually using:
atRandom: aGenerator "Answer a random element of the receiver. Uses aGenerator which should be kept by the user in a variable and used every time. Use this instead of #atRandom for better uniformity of random numbers because only you use the generator. Causes an error if self has no elements." | ind entry | entry _ nil. [entry == nil] whileTrue: [ self emptyCheck. ind _ aGenerator nextInt: array size. entry _ array at: ind. ]. ^entry.
Attachments:
squeak-dev@lists.squeakfoundation.org