Random, random, random

well random had me foxed.  As the clone was short-lived process it only
called random once - and so always got the same answer.

random has to be seeded to give different answers when called once from
a process - so this is now seeded in leveed_log
This commit is contained in:
Martin Sumner 2017-03-06 13:51:38 +00:00
parent eb6f668fcd
commit c1dc92720c
2 changed files with 15 additions and 2 deletions

View file

@ -26,6 +26,8 @@
{"G0001",
{info, "Generic log point"}},
{"G0002",
{info, "Generic log point with term ~w"}},
{"D0001",
{debug, "Generic debug log"}},
@ -133,6 +135,8 @@
{info, "Garbage collection on manifest removes key for filename ~s"}},
{"P0037",
{info, "Merging of penciller L0 tree to size ~w complete"}},
{"P0038",
{info, "Bad record when closing manifest ~w"}},
{"PC001",
{info, "Penciller's clerk ~w started with owner ~w"}},
@ -351,7 +355,10 @@ log_timer(LogReference, Subs, StartTime) ->
end.
log_randomtimer(LogReference, Subs, StartTime, RandomProb) ->
case random:uniform() < RandomProb of
{R, _S} = random:uniform_s({erlang:phash2(self()),
element(2, StartTime),
element(3, StartTime)}),
case R < RandomProb of
true ->
log_timer(LogReference, Subs, StartTime);
false ->