*/
Written some cool source code? Upload it to Programmer's Heaven.
*/

View \xrndi.h

Application of the identity matrix II. v05

Submitted By: xhunga
Rating: starstar (Rate It)


/* xkrndf.h                    freeware                    [[Email Removed]]  */


/* ------------------------------ FUNCTION -------------------------- rnd0I() */
/*Call :  time_t t;                                                           */
/*           int i;                                                           */
/*                                                                            */
/*        srand(time(&t));                                                    */
/*           i = rnd0I(9);                                                    */
/* -------------------------------------------------------------------------- */
int rnd0I(
int maxI)
{
int x;

    x = rand() % maxI;
    if(x)
    {
     x *= -pow(-1,x);
    }
 return(x);
}

/* ------------------------------ FUNCTION -------------------------- rnd0I() */
/*Call :  time_t t;                                                           */
/*           int i;                                                           */
/*                                                                            */
/*        srand(time(&t));                                                    */
/*           i = rnd0I(9);                                                    */
/* -------------------------------------------------------------------------- */
int rndp0I(
int maxI)
{
 return(rand() % maxI);
}

/* ------------------------------ FUNCTION --------------------------- rndI() */
/*Call :  time_t t;                                                           */
/*           int i;                                                           */
/*                                                                            */
/*        srand(time(&t));                                                    */
/*           i = rndI(9);                                                     */
/* -------------------------------------------------------------------------- */
int rndI(
int maxI)
{
int x;

    x  = (rand() % maxI) + 1;
    x *= -pow(-1,x);

 return(x);
}

/* ------------------------------ FUNCTION --------------------------- rndI() */
/*Call :  time_t t;                                                           */
/*           int i;                                                           */
/*                                                                            */
/*        srand(time(&t));                                                    */
/*           i = rndI(9);                                                     */
/* -------------------------------------------------------------------------- */
int rndpI(
int maxI)
{
 return((rand() % maxI) + 1);
}

corner
© 1996-2008 CommunityHeaven LLC. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
North American business development: Nicolai Wadstrom. Publisher: Lars Hagelin.