# Randomize iteration order¶

Author: Lukas Breitwieser
In this tutorial we show how to randomize the order that BioDynaMo uses in each iteration to process the agents.

Let's start by setting up BioDynaMo notebooks.

Let's create two helper functions:

• AddAgents to add four agents to the simulation
• print_uid which prints the uid of the given agent

We define an experiment which

1. takes a simulation object as input
3. calls print_uid for each agent
6. calls print_uid for each agent again
BioDynaMo also provides a wrapper called RandomizedRm, which, as the name suggests, randomizes the iteration order after each iteration. It just takes two lines to add this functionality to the simulation.