152k views
1 vote
Jump to level 1 Given irteger variables seedVal, lcwestGrous and highestGraup seed the paeudarandom number gererator with seefvel. Then, output three randam tahle sizes in the range lrwestGroup tn highestGiroup inclusive I astly, given a tntal of 138 people, output the number nf peap e that are not at a tabe. Fnd each output with a newline. Fx. If lawestGroup is a and highestGroup is 17 , then a possihle output is: 6

9
10
113
​ Note: The number of peoole that are not at a tahle is 138 -tahle −-tahle? - table3.

1 Answer

2 votes

Final answer:

The pseudorandom number generator is used to generate three random table sizes in the given range. The number of people not at a table can be calculated by subtracting the sum of the three random table sizes from the total number of people (138).

Step-by-step explanation:

To generate random table sizes, we can use the pseudorandom number generator with the given seedVal. We can set the range of table sizes from lowestGroup to highestGroup inclusive. Here is the step-by-step process:

  1. Seed the pseudorandom number generator with seedVal.
  2. Generate the first random table size using the formula: table1 = lowestGroup + (rand() % (highestGroup - lowestGroup + 1)).
  3. Generate the second random table size using the same formula.
  4. Generate the third random table size using the same formula.
  5. Output the three random table sizes, each on a new line.
  6. To calculate the number of people not at a table, subtract the sum of the three random table sizes from the total number of people (138).
  7. Output the number of people not at a table.

Learn more about generating random table sizes and calculating the number of people not at a table here:

User Pragman
by
8.0k points