Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int _random()
- {
- char path[1035];
- FILE *fp = popen("bash -c 'echo $RANDOM'", "r");
- while (fgets(path, sizeof(path)-1, fp) != NULL) { // printf("%s", path);
- }
- pclose(fp);
- srand(atoi(path)); // printf("%d", toi(path));
- return ((rand()%220)-100);
- }
- main()
- {
- int record;
- int up=0,mid=0,low=0;
- while(1)
- {
- record=_random();
- // printf("%d \n",record);
- if(record>=90)
- {
- if(up != 1)
- printf("__Up %d \n",record);
- up=1;
- }
- else if(record<90 && record >=-90)
- {
- if(mid != 1)
- printf("__Mid %d \n",record);
- mid=1;
- }
- else
- {
- if(low != 1)
- printf("__Low %d \n",record);
- low=1;
- }
- if(low == 1 && mid == 1 && up ==1)break;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement