# How Does Flower Select Clients for Each Federated Learning Round?

**URL:** <https://discuss.flower.ai/t/how-does-flower-select-clients-for-each-federated-learning-round/442>\
**Category:** Flower Help - Beginners\
**Tags:** flower\
**Created:** [November 20, 2024, 10:09am UTC](https://discuss.flower.ai/t/how-does-flower-select-clients-for-each-federated-learning-round/442 "2024-11-20T10:09:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![candido-bisneto](https://avatars.discourse-cdn.com/v4/letter/c/e19adc/32.png) [@candido-bisneto](https://discuss.flower.ai/u/candido-bisneto)\
**Post date:** [November 20, 2024, 10:09am UTC](https://discuss.flower.ai/t/how-does-flower-select-clients-for-each-federated-learning-round/442/1 "2024-11-20T10:09:38Z")

</div>

I am using the Flower and noticed that the number of clients selected for each round varies. For instance, in one of the logs I collected, I observed that in the first round, 5 clients were selected, while in the next round, 10 clients were selected, even though all clients were available. I would like to better understand the criteria or metrics Flower uses to select clients for each round. Is this controlled by specific parameters (such as `fraction_fit` or `min_fit_clients`)? Additionally, is there any randomness involved or factors based on the state of the clients (e.g., their availability or execution status)? I couldn’t find this information clearly explained in the documentation. Attached is an example of the log for context.

 ![Screenshot 2024-11-19 144430](https://europe1.discourse-cdn.com/flex013/uploads/flower/original/1X/19833ac7bbcfe661f55fea796f6129fcd14f90fa.png)

---

<div class="post-metadata">

**Author:** ![adam-narozniak](https://dub1.discourse-cdn.com/flex013/user_avatar/discuss.flower.ai/adam-narozniak/32/33_2.png) [@adam-narozniak](https://discuss.flower.ai/u/adam-narozniak)\
**Post date:** [November 21, 2024, 3:29pm UTC](https://discuss.flower.ai/t/how-does-flower-select-clients-for-each-federated-learning-round/442/2 "2024-11-21T15:29:16Z")

</div>

Hi,  
Yes, the sampling is determined by the parameters in the strategies e.g. here’s an explanation from FedAvg docs [FedAvg - Flower Framework](https://flower.ai/docs/framework/ref-api/flwr.server.strategy.FedAvg.html#flwr.server.strategy.FedAvg).

Generally, the whole FL won’t start before there are enough **min\_available\_clients**. Once it’s met, the number of clients is the fraction, e.g. **fraction\_fit** or **min\_fit\_clients** if the fraction\_fit \* available\_clients is smaller than the min\_fit\_clients.

So, in the case of the first round, the number of clients can be smaller if not all of them have been registered yet, but the min\_available\_clients are available. (THB, in my personal opinion, is not a clear design choice, and I hope it’ll change in the future for a more clean solution).

The randomness in ClientManger is from the random module, so you can set the seed via `random.seed`.
