Имя пользователя:
Пароль:
 

Показать сообщение отдельно

Аватара для Guest

Guest


Профиль | Цитировать


Header File

stdlib.h

Category

Math Routines

Prototype

int random(int num);

Description

Random number generator.

random returns a random number between 0 and (num-1). random(num) is a macro defined in stdlib.h. Both num and the random number returned are integers.

Return Value

random returns a number between 0 and (num-1).
//=========================================

/* random example */
#include <stdlib.h>
#include <stdio.h>
#include <time.h>

/* prints a random number in the range 0 to 99 */
int main(void)
{
   randomize();
   printf("Random number in the 0-99 range: %d\n", random (100));
   return 0;
}

Отправлено: 18:11, 12-11-2003 | #2