Imam jedan primjer ali mi se brojevi ponavljaju:
Code:
#include "stdafx.h"
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char* argv[])
{
int rolls=4;
srand((unsigned int)time((time_t *)NULL));
while(rolls--)
{
printf(" %d\n", (rand()%6)+1);
}
return 0;
}
#include "stdafx.h"
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char* argv[])
{
int rolls=4;
srand((unsigned int)time((time_t *)NULL));
while(rolls--)
{
printf(" %d\n", (rand()%6)+1);
}
return 0;
}
rezuktat:
npr.
4
4
3
2