Skip to content

Commit

Permalink
fix(gar): modify random to use unbounded and convert to 32 bit signed…
Browse files Browse the repository at this point in the history
… integer
  • Loading branch information
dtfiedler committed May 13, 2024
1 parent 5231b39 commit 61f7bae
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion contract/src/gar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ function gar.getPrescribedObserversForEpoch(epochStartTimestamp, epochEndTimesta
local hash = timestampEntropyHash
while #prescribedObserversAddresses < gar.settings.observers.maxObserversPerEpoch do
local hashString = crypto.utils.array.toString(hash)
local random = crypto.random(0, 1, hashString)
local random = crypto.random(nil, nil, hashString) / 0xffffffff
local cumulativeNormalizedCompositeWeight = 0
-- use ipairs as filtered observers is an array
for _, observer in ipairs(filteredObservers) do
Expand Down

0 comments on commit 61f7bae

Please sign in to comment.