Best practices for random number generation

8 views
Skip to first unread message

Stephen Davies

unread,
Feb 23, 2021, 4:15:33 PM2/23/21
to ProjectMesa
I see on https://mesa.readthedocs.io/en/latest/best-practices.html 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

unread,
Feb 24, 2021, 8:26:32 PM2/24/21
to Stephen Davies, ProjectMesa
Hi Stephen - There was a discussion about this in the issues section. It's really simple, here's the solution: https://github.com/projectmesa/mesa/issues/958#issuecomment-733651008

I just created a pull request to add it to the docs: https://github.com/projectmesa/mesa/pull/998

--
Project repos: github.com/projectmesa
---
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 projectmesa...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/projectmesa/41b7f0c6-6809-48fc-bafd-c6daf9958c3bn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages