gt()
can affect results of operations that are based on random number generation
#1915
Labels
gt()
can affect results of operations that are based on random number generation
#1915
Hi, I recently experienced unexpected behavior of
{gt}
regarding operations that are based on random number generation. When I added agt
to anRmd
, I noticed a slight change of results of a machine learning model, indicating thatgt()
changes the seed of the random number generator.Created on 2024-11-03 with reprex v2.1.1
Session info
This seems to be induced by the
random_id()
function.I'd suggest to use
withr::with_seed()
together with a seed that is e.g. derived from the last digits of the users system time to avoid touching the system settings and potentially messing with the seeds that are set by the user.(Thanks, @maike2011, for the idea)
The text was updated successfully, but these errors were encountered: