Best practices for random number generation

Skip to first unread message

Stephen Davies

Feb 23, 2021, 4:15:33 PMFeb 23
to ProjectMesa
I see on that Mesa Model and Agent objects conveniently have a "random" property which you can access to generate random numbers, and that this takes care of setting the seed for a simulation, etc.

What if I need to use NumPy's random number generator, though? What's the preferred approach for keeping a single numpy.random generator around for all parts of the code to use?

- Stephen

Majd Al-shihabi

Feb 24, 2021, 8:26:32 PMFeb 24
to Stephen Davies, ProjectMesa
Hi Stephen - There was a discussion about this in the issues section. It's really simple, here's the solution:

I just created a pull request to add it to the docs:

Project repos:
You received this message because you are subscribed to the Google Groups "ProjectMesa" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit
Reply all
Reply to author
0 new messages