I think that the just committed threadsafe random is overly complex. I provided a working version some time ago that is less intrusive. https://forum.lazarus.freepascal.org/index.php/topic,35050.msg242571.html#msg242571