Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Cadence random in range & commit-reveal helper contract + Cadence tests #23

Merged
merged 11 commits into from
Oct 10, 2024
Prev Previous commit
Update contracts/RandomConsumer.cdc
Co-authored-by: Tarak Ben Youssef <[email protected]>
sisyphusSmiling and tarakby authored Oct 10, 2024
commit 3c4fbe4b6586f94b69c844ff0d1d373d3f273e01
2 changes: 1 addition & 1 deletion contracts/RandomConsumer.cdc
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@ access(all) contract RandomConsumer {
/// @return A random number in the range [min, max]
///
access(all) fun getRevertibleRandomInRange(min: UInt64, max: UInt64): UInt64 {
sisyphusSmiling marked this conversation as resolved.
Show resolved Hide resolved
return revertibleRandom<UInt64>(modulo: max - min + 1)
return min + revertibleRandom<UInt64>(modulo: max - min + 1)
}

/// Retrieves a random number in the range [min, max] using the provided PRG