MCPcopy Index your code
hub / github.com/NetHack/NetHack / rn2

Function rn2

src/rnd.c:94–107  ·  view source on GitHub ↗

0 <= rn2(x) < x */

Source from the content-addressed store, hash-verified

92
93/* 0 <= rn2(x) < x */
94int
95rn2(int x)
96{
97#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED)
98 if (x <= 0) {
99 impossible("rn2(%d) attempted", x);
100 return 0;
101 }
102 x = RND(x);
103 return x;
104#else
105 return RND(x);
106#endif
107}
108
109/* 0 <= rnl(x) < x; sometimes subtracting Luck;
110 good luck approaches 0, bad luck approaches (x-1) */

Callers 15

RandomizeMethod · 0.85
FuzzTimerProcFunction · 0.85
console_poskeyFunction · 0.85
pick_roomFunction · 0.85
fill_zooFunction · 0.85
morguemonFunction · 0.85
mkswampFunction · 0.85
shrine_posFunction · 0.85
courtmonFunction · 0.85
chweponFunction · 0.85
nemesis_speaksFunction · 0.85

Calls 2

RNDFunction · 0.85
impossibleFunction · 0.70

Tested by

no test coverage detected