mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-22 11:17:19 +00:00
b945938c63
frequent use of ``register var'' instead of ``register int var'' and the removal of the register hint in the previous commit.
34 lines
290 B
C
34 lines
290 B
C
/* rnd.c - version 1.0.2 */
|
|
/* $FreeBSD$ */
|
|
|
|
#include <stdlib.h>
|
|
|
|
#define RND(x) (random() % x)
|
|
|
|
rn1(x,y)
|
|
int x,y;
|
|
{
|
|
return(RND(x)+y);
|
|
}
|
|
|
|
rn2(x)
|
|
int x;
|
|
{
|
|
return(RND(x));
|
|
}
|
|
|
|
rnd(x)
|
|
int x;
|
|
{
|
|
return(RND(x)+1);
|
|
}
|
|
|
|
d(n,x)
|
|
int n,x;
|
|
{
|
|
int tmp = n;
|
|
|
|
while(n--) tmp += RND(x);
|
|
return(tmp);
|
|
}
|