X-Git-Url: https://pd.if.org/git/?p=pdclib;a=blobdiff_plain;f=functions%2Fstdlib%2Frand.c;h=1e8f3cd789b2542ba0e7ab78c969cb412ff325c7;hp=1ad3e915d76ff0e971810c008a719ad8d8da553c;hb=da0f3f353d417fed71f358a48d5d5394145e460d;hpb=8a210237d6ac0dfb36ca14b5aebe8be2b967b9e6 diff --git a/functions/stdlib/rand.c b/functions/stdlib/rand.c index 1ad3e91..1e8f3cd 100644 --- a/functions/stdlib/rand.c +++ b/functions/stdlib/rand.c @@ -1,8 +1,4 @@ -/* $Id$ */ - -/* Release $Name$ */ - -/* rand() +/* rand( void ) This file is part of the Public Domain C Library (PDCLib). Permission is granted to use, modify, and / or redistribute at will. @@ -12,21 +8,20 @@ #ifndef REGTEST -int rand() +int rand( void ) { _PDCLIB_seed = _PDCLIB_seed * 1103515245 + 12345; - return (unsigned int) ( _PDCLIB_seed / 65536 ) % 32768; + return (int)( _PDCLIB_seed / 65536 ) % 32768; } #endif #ifdef TEST -#include <_PDCLIB_test.h> +#include "_PDCLIB_test.h" -int main() +int main( void ) { int rnd1, rnd2; - BEGIN_TESTS; TESTCASE( ( rnd1 = rand() ) < RAND_MAX ); TESTCASE( ( rnd2 = rand() ) < RAND_MAX ); srand( 1 );