You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Instances of Random have a seed. The seed can be explicitly set on creation (via seed:), or it can be generated from current timestamp (via new). I wanted to see how much slower is to generate the seed, so wrote this benchmark:
But discovered that new was faster than seed:, and it doesn't make sense:
new: 549,165 per second
seed: 295,684 per second
What happens is that Random seed: 7 first initializes the instance with a timestamp-based seed, and immediately after overrides it with the explicitly set.
This is in Pharo 12 and 13. I have a PR to fix it.
The text was updated successfully, but these errors were encountered:
Instances of
Random
have a seed. The seed can be explicitly set on creation (viaseed:
), or it can be generated from current timestamp (vianew
). I wanted to see how much slower is to generate the seed, so wrote this benchmark:But discovered that
new
was faster thanseed:
, and it doesn't make sense:new
: 549,165 per secondseed:
295,684 per secondWhat happens is that
Random seed: 7
first initializes the instance with a timestamp-based seed, and immediately after overrides it with the explicitly set.This is in Pharo 12 and 13. I have a PR to fix it.
The text was updated successfully, but these errors were encountered: