Skip to content
Esc
↑↓navigate↵open⌘Jpreview
On this page

lint/style/prefer-random-int

In the modernize set. Unsafe fix: it can change behaviour.

What it does

Replaces rand, srand, getrandmax functions calls with their mt_* analogs or random_int.

Configuration

[lint.rules]
"style/prefer-random-int" = "error"

To skip it in some files, add an override or a @pun-ignore-file comment.

Options

Name Type Allowed values Default Upstream name
replacements map Any { "getrandmax" = "mt_getrandmax", "rand" = "mt_rand", "srand" = "mt_srand" } replacements

Replaces

More lint/style rules · Edit this page

Last updated on

Was this page helpful?