MCPcopy Create free account
hub / github.com/SimHacker/micropolis / Rand

Function Rand

micropolis-activity/src/sim/s_sim.c:1194–1205  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1192#define RANDOM_RANGE 0xffff
1193
1194short
1195Rand(short range)
1196{
1197 int maxMultiple, rnum;
1198
1199 range++;
1200 maxMultiple = RANDOM_RANGE / range;
1201 maxMultiple *= range;
1202 while ((rnum = Rand16()) >= maxMultiple)
1203 continue;
1204 return (rnum % range);
1205}
1206
1207
1208int

Callers 14

s_gen.cFile · 0.85
DoUpdateMapFunction · 0.85
s_msg.cFile · 0.85
SimCmdRandFunction · 0.85
s_zone.cFile · 0.85
w_editor.cFile · 0.85
putDownParkFunction · 0.85
w_tool.cFile · 0.85
s_traf.cFile · 0.85
w_sprite.cFile · 0.85
w_keys.cFile · 0.85
s_disast.cFile · 0.85

Calls 1

Rand16Function · 0.70

Tested by

no test coverage detected