MCPcopy Create free account
hub / github.com/NetHack/NetHack / d

Function d

src/rnd.c:174–188  ·  view source on GitHub ↗

d(N,X) == NdX == dX+dX+...+dX N times; n <= d(n,x) <= (n*x) */

Source from the content-addressed store, hash-verified

172
173/* d(N,X) == NdX == dX+dX+...+dX N times; n <= d(n,x) <= (n*x) */
174int
175d(int n, int x)
176{
177 int tmp = n;
178
179#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED)
180 if (x < 0 || n < 0 || (x == 0 && n != 0)) {
181 impossible("d(%d,%d) attempted", n, x);
182 return 1;
183 }
184#endif
185 while (n--)
186 tmp += RND(x);
187 return tmp; /* Alea iacta est. -- J.C. */
188}
189
190/* 1 <= rne(x) <= max(u.ulevel/3,5) */
191int

Callers 15

really_doneFunction · 0.85
mk_mplayerFunction · 0.85
dositFunction · 0.85
worm_moveFunction · 0.85
worm_nomoveFunction · 0.85
cutwormFunction · 0.85
peffect_waterFunction · 0.85
peffect_boozeFunction · 0.85
peffect_invisibilityFunction · 0.85
peffect_healingFunction · 0.85
peffect_extra_healingFunction · 0.85
peffect_gain_energyFunction · 0.85

Calls 2

RNDFunction · 0.85
impossibleFunction · 0.70

Tested by

no test coverage detected