Question: C Program Using pthread: Write a random number generator in C (not C++) using Linux. Must use pthread, arrays, and seed values for random numbers.
C Program Using pthread:
Write a random number generator in C (not C++) using Linux. Must use pthread, arrays, and seed values for random numbers. Please see program output in the screen shot below. There are 5 sets of Gen from 0 to 4. Gen 0 was created from a seed value. Gen 1 thur 4 was created based on the rules below.
Values set for array:
Row 5
Column 6
High Number - 20
Rules:
% 10 == 0 0
Under 50 Add 3
Over 50 under 150 Subtract 3 Cant go negative
Over 150 1
Note:
Take a look at the 6 circled in red in Gen 0. Now add up all the numbers in the yellow box which in 37. If you look at the rules above 37 is under 50 so you add 3 to the 6. So, when Gen 1 is created 9 is put in that location. It should do that for all numbers in the array. The outer zeros are not part of the array. Your output should look like the output in the screenshot below. I think the value 0 was used for the seed but Im not sure.

-0000000-0000000- 0102910 | 0 5 7 6 9 5 0 | 0809280 -03 20770-000340 0 30 | 0 2 0 91.60 -07 s312 0 | 0 0 08.00 0396370 0 00170 0 0289 0 -0516 0 30030 0603000 0629600 0964630 0360220 0637900 en o o o o o o o o o o o o o o Ge 0 0 0 0 0 0 0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
