I have a set oneHundredInactiveSynapses and I would like to manipulate a random 21 of the 100 inactiveSynapses in that set and then stop. I feel like there should be a easy way to do this, but I just can't think of anything right now.
for (Synapse inactiveSynapse : oneHundredInactiveSynapses) { // I want to call a method on the inactiveSynapse like inactiveSynapse.setActiveState(true); // but I only want to do this to 21 of the synapses. How can I do this? } Other points:
- making oneHundredInactiveSynapses into an array is not an option
- I don't care which 21 become active
forloop with a counter that counts up to 21.