Source:Hack 1.0/rnd.c

From NetHackWiki
Revision as of 20:41, 29 August 2006 by Jaytbot (talk | contribs) (Automated source code upload)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Below is the full text to rnd.c from the source code of Hack 1.0. To link to a particular line, write [[Hack 1.0/rnd.c#line123]], for example.

Warning! This is the source code from an old release. For the latest release, see Source code

Screenshots and source code from Hack are used under the CWI license.

1.    #define RND(x)	((rand()>>3) % x)
2.    
3.    rn1(x,y)
4.    register int x,y;
5.    {
6.    	return(RND(x)+y);
7.    }
8.    
9.    rn2(x)
10.   register int x;
11.   {
12.   	return(RND(x));
13.   }
14.   
15.   rnd(x)
16.   register int x;
17.   {
18.   	return(RND(x)+1);
19.   }
20.   
21.   d(n,x)
22.   register int n,x;
23.   {
24.   	register int tmp = n;
25.   
26.   	while(n--) tmp += RND(x);
27.   	return(tmp);
28.   }