Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/careercup/ctci
/ randomInt
Method
randomInt
java/Chapter 7/Question7_3/Question.java:4–6 ·
view source on GitHub ↗
(int n)
Source
from the content-addressed store, hash-verified
2
3
public
class
Question {
4
public
static
int
randomInt(
int
n) {
5
return
(
int
) (Math.random() * n);
6
}
7
8
public
static
void
main(String[] args) {
9
for
(
int
i = 0; i < 10; i++) {
Callers
1
main
Method · 0.95
Calls
no outgoing calls
Tested by
no test coverage detected