Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <pthread.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
- int radius = 100;
- int Cnum_of_points;
- typedef struct // tuple structure
- {
- int x, y;
- } Tuple;
- const int MAXSIZE = 50000000;
- Tuple nums[MAXSIZE];
- int Tnum_of_points = 0;
- void new_point() // generate a new tuple
- {
- int x = (rand() % (radius+1-0))+0;
- int y = (rand() % (radius+1-0))+0;
- Tuple a;
- a.x = x;
- a.y = y;
- if (Tnum_of_points < MAXSIZE)
- {
- nums[Tnum_of_points] = a;
- ++Tnum_of_points;
- }
- else
- {
- // pass -- full
- }
- }
- int main()
- {
- printf("size of nums: %d\n", Tnum_of_points);
- new_point();
- printf("size of nums: %d\n", Tnum_of_points);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement