Hi Gabriel,

Thanks for your help. This way is much simpler than trying to get a true
random generator in the C++ workload.

Best,
Duc Anh

On Tue, 20 Jul 2021 at 15:40, Gabriel Busnot via gem5-users <
gem5-users@gem5.org> wrote:

> Indeed, gem5 is designed to be deterministic so all random number
> generation should rely on a deterministically seeded random number
> generator. This random number generator normally is 'random_mt' located in
> src/base/random.cc. However not all random number generated in gem5 relies
> on this generator, yet.
>
> Looking at syscall emulation implementations, it looks like a dedicated
> random generator is used here for emulating a read to /dev/urandom:
> src/kern/linux/linux.cc:126. You could replace "random.random<uint8_t>(0,
> 255)" with "random_mt.random<uint8_t>(0, 255)" to use the main random
> number generator. Not tested but should work. Then, you can seed random_mt
> from your python script using "seedRandom(int(<YOUR_SEED>))". seedRandom is
> from the m5.core module. I personally like to use a --seed command line
> option to set the seed more conveniently.
>
> Gabriel
> _______________________________________________
> gem5-users mailing list -- gem5-users@gem5.org
> To unsubscribe send an email to gem5-users-le...@gem5.org
> %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
>
_______________________________________________
gem5-users mailing list -- gem5-users@gem5.org
To unsubscribe send an email to gem5-users-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to