Skip to content

Commit 4ac10bf

Browse files
Helios-vmggregnazario
authored andcommitted
Added random_modulo documentation.
1 parent 8272c6d commit 4ac10bf

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/content/docs/build/smart-contracts/linter.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,10 @@ and
271271
};
272272
```
273273

274+
### `random_modulo`
275+
276+
Checks for expressions of the form `u{8|16|32|64|128|256}_integer() % x`. Getting the remainder of a division where the dividend is a random number results in a non-uniform distribution. For example, the result of `u8_integer() % 255` is twice as likely to be 0 than 1. Instead of wrapping with modulo, `u{8|16|32|64|128|256}_range(0, x)` can be used, which produces a uniform distribution.
277+
274278
### `self_assignment`
275279

276280
Checks for patterns where a variable or a field of a struct is assigned to itself and suggests removing the assignment. These assignments do not affect the state of the program. Examples include:

0 commit comments

Comments
 (0)