zrndi.h
来自「[[ Complex Matrices : Language c]]」· C头文件 代码 · 共 74 行
H
74 行
/* xkrndf.h free ware xhunga@tiscali.fr */
/* ------------------------------ FUNCTION -------------------------- rnd0_I() */
/*Call : time_t t; */
/* int i; */
/* */
/* srand(time(&t)); */
/* i = rnd0_I(9); */
/* -------------------------------------------------------------------------- */
int rnd0_I(
int maxI)
{
int x;
x = rand() % maxI;
if(x)
{
x *= -pow(-1,x);
}
return(x);
}
/* ------------------------------ FUNCTION -------------------------- rnd0_I() */
/*Call : time_t t; */
/* int i; */
/* */
/* srand(time(&t)); */
/* i = rnd0_I(9); */
/* -------------------------------------------------------------------------- */
int rndp0_I(
int maxI)
{
return(rand() % maxI);
}
/* ------------------------------ FUNCTION --------------------------- rnd_I() */
/*Call : time_t t; */
/* int i; */
/* */
/* srand(time(&t)); */
/* i = rnd_I(9); */
/* -------------------------------------------------------------------------- */
int rnd_I(
int maxI)
{
int x;
x = (rand() % maxI) + 1;
x *= -pow(-1,x);
return(x);
}
/* ------------------------------ FUNCTION --------------------------- rnd_I() */
/*Call : time_t t; */
/* int i; */
/* */
/* srand(time(&t)); */
/* i = rnd_I(9); */
/* -------------------------------------------------------------------------- */
int rndp_I(
int maxI)
{
return((rand() % maxI) + 1);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?