Ich möchte große Zufallszahlen in c. Das Problem ist, dass die größte Zahl, die srand() erzeugen kann, ungefähr 37000 ist. Ich möchte eine Zahl im Intervall von 70000 bis 2150000000 erstellen. Könnte mir jemand dabei helfen?Generiere große Zahlen mit srand() in c
Zufallszahlengenerator:
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
int main()
{
srand(time(NULL));
int i;
for (i=0; i<50; i++)
{
int random = rand();
printf("%d\n",random);
}
return 0;
}
Haben Sie vor dem Fragen eine Suche durchgeführt? Es gibt viele Duplikate hier http://stackoverflow.com/questions/28115724/getting-big-random-numbers-in-cc http://stackoverflow.com/questions/21418478/getting-random-numbers-larger- than-rand-max http://Stackoverflow.com/a/3665305/995714 –