![]() |
C - Entwicklung Mathematik: Zufallszahlen Homepage von PS-Trainer - C-Entwicklung - Mathematik - an PS-Trainer |
|
| Math and related | Random Numbers |
| rand | Generate a pseudorandom number. |
| srand | Set a random starting point. |
| rand Generates a pseudorandom number. int rand( void );
Remarks The rand function returns a pseudorandom integer in the range 0 to RAND_MAX. Use the srand function to seed the pseudorandom-number generator before calling rand. Subject: Floating-Point Support Routines Keywords: See also srand |
||||||
Return Value
|
||||||
|
Example #include <stdlib.h> void main( void ) /* Display 10 numbers. */ |
| srand Sets a random starting point. void srand( unsigned int seed );
Remarks The srand function sets the starting point for generating a series of pseudorandom integers. To reinitialize the generator, use 1 as the seed argument. Any other value for seed sets the generator to a random starting point. rand retrieves the pseudorandom numbers that are generated. Calling rand before any call to srand generates the same sequence as calling srand with seed passed as 1. Subject: Floating-Point Support Routine Keywords: See also rand
|
||||||
| Return Value None Parameter
|
||||||
|
Example #include <stdlib.h> void main( void ) /* Display 10 numbers. */ |
| Aktuelle Daten dieser Seite | Letzte Änderung: |
| |