Created
June 9, 2017 03:37
-
-
Save rsnemmen/a46fcd4d329087b22006bf8c40069ad2 to your computer and use it in GitHub Desktop.
Generates 1000 pseudo random numbers (integers)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Generates 1000 pseudo random numbers (integers). | |
| */ | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <time.h> | |
| int main(){ | |
| int i, imax=1000; | |
| float ran; | |
| srand(time(NULL)); // initialize pseudo-random number generator | |
| for (i = 0; i < imax; i++){ | |
| ran = rand() % 1000; | |
| printf("%f \n", ran); | |
| } | |
| return(0); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment