Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/spotbugs/spotbugs
/ nextInt
Method
nextInt
spotbugsTestCases/src/java/BadRandomInt.java:10–13 ·
view source on GitHub ↗
(int n)
Source
from the content-addressed store, hash-verified
8
static
Random r =
new
Random();
9
10
@ExpectWarning(
"Dm"
)
11
int
nextInt(
int
n) {
12
return
(
int
) (r.nextDouble() * n);
13
}
14
15
@ExpectWarning(
"Dm"
)
16
int
nextInt() {
Callers
15
randomInt
Method · 0.80
randomInt2
Method · 0.80
randomInt3
Method · 0.80
main
Method · 0.80
getRandomElement
Method · 0.80
getRandomElement2
Method · 0.80
getSecureRandomElement
Method · 0.80
getNonNegativeRandomInt
Method · 0.80
getNonNegativeSecureRandomInt
Method · 0.80
getRandomIntFalsePositive
Method · 0.80
getRandomIntFalsePositive2
Method · 0.80
getRandomString
Method · 0.80
Calls
no outgoing calls
Tested by
no test coverage detected