Page MenuHomeDevCentral
Paste P110

random.c - organize the program in units
ActivePublic

Authored by dereckson on Aug 21 2015, 10:12.
Tags
None
Referenced Files
F6953: Fork of P109 Masterwork From Distant Lands
Aug 21 2015, 10:12
Subscribers
None
#include <stdio.h>
#include <stdlib.h>
int aleatoire (int borne_1, int borne_2)
{
int nombre;
nombre = rand() % ((borne_2 - borne_1) + 1) + borne_1;
return nombre;
}
void initialize ()
{
srand((unsigned int)time(NULL));
}
void printRandomValues (int count, int borne_inf, int borne_sup)
{
int i;
for (i = 0 ; i < count ; i++) {
printf("%d\n", aleatoire(borne_inf, borne_sup));
}
}
int main ()
{
initialize()
printRandomValues(10, 1000, 1500);
}

Event Timeline

dereckson changed the title of this paste from untitled to Fork of P109 Masterwork From Distant Lands.
dereckson updated the paste's language from autodetect to .
dereckson changed the title of this paste from Fork of P109 Masterwork From Distant Lands to random.c - organize the program in units.Aug 21 2015, 10:18
dereckson updated the paste's language from to c.