This question relates to pseudo random number generators. You will write a c program that pulls the Powerball numbers. You will demonstrate how a deterministic number generator works. In Powerball there are 5 white numbered balls that are pulled out of a drum containing 69 balls numbered 1-69. You cannot pull the same number twice. Additionally one red ball is numbered 1 to 26. You don’t have to worry about the PowerPlay option.
A) Write a c program that simulates a single Powerball drawing (5 white numbers and a single red number) and show how it might work over a period of 10 different drawing dates. In other words, use your seed to draw 5 white numbers and 1 red number for week 1. Then, use a new seed for to draw 5 white numbers and 1 red number to simulate week 2. And, yes, I know Powerball gets drawn twice weekly. I am trying to simplify the instructions. Take a screenshot of the output for all 10 weeks.
B) Explain how knowing the seeding of that PRNG will let you buy the winning ticket for any particular week. In other words, how could you rig the selection of the Powerball numbers similar to how Edward Tipton rigged the Hot Lotto?
C) Explain a better way to get the seeding that would introduce more entropy in your program (or maybe in the multi-state lottery system) that would solve this deterministic pattern.
Please find the code below:::
#include <stdio.h>
#include <stdlib.h>
void printSeed(int *whiteBalls,int redBall){
printf("Seed set is -> ");
int i;
for(i=0;i<5;i++){
printf("%d ",whiteBalls[i]);
}
printf(":: %d\n",redBall);
}
void getPowerSeed(){
int whiteBalls[5];
int redBall=0;
int i,j;
int duplicate=0;
for(i=0;i<5;i++){
do{
whiteBalls[i] = rand()%69+1;
duplicate=0;
for(j=0;j<i;j++){
if(whiteBalls[j]==whiteBalls[i]){
duplicate=1;
}
}
}while(duplicate==1);
}
do{
redBall = rand()%25+1;
duplicate=0;
for(j=0;j<5;j++){
if(whiteBalls[j]==redBall){
duplicate=1;
}
}
}while(duplicate==1);
printSeed(whiteBalls,redBall);
}
int main()
{
int i;
for(i=1;i<=10;i++){
printf("Draw for week %d\n",i);
printf("First Draw ");
getPowerSeed();
printf("Second Draw ");
getPowerSeed();
printf("\n");
}
return 0;
}
output:
This question relates to pseudo random number generators. You will write a c program that pulls...
The Powerball lottery is played twice each week in 44 states, the District of Columbia, and the Virgin Islands. To play Powerball, a participant must purchase a $2 ticket, select five numbers from the digits 1 through 69, and then select a Powerball number from the digits 1 through 26. To determine the winning numbers for each game, lottery officials draw 5 white balls out a drum of 69 white balls numbered 1 through 69 and 1 red ball out...
Bonus Question The Powerball multi-state lottery is played by picking 5 numbers between 1 and 59 (the white balls) and an additional bonus number between 1 and 39 (the red Powerball). Twice a week 5 white balls and a red Powerball are drawn from two separate drums revealing the winning numbers. To win at Powerball, your numbers must match the numbers on the winning balls in any of the following nine ways: 5 white balls + red Powerball (Grand Prize)...
The expected winnings are defined as the value of the jackpot multiplied by the probability of winning it. How large should the Powerball jackpot be in order for the expected winnings to exceed the ticket price ($2)? The Powerball lottery drawing of January 13th, 2016 had the largest payoff in its history, of $1.6 billion dollars. The lottery draw consists of picking 5 white balls at random, from an urn of 69 balls, numbered from 1 to 69 (without replacement,...
Write a C++ program that simulates playing the Powerball game. The program will generate random numbers to simulate the lottery terminal generated numbers for white balls and red Powerball. The user will have the option to self-pick the numbers for the balls or let the computer randomly generate them. Set the Grand Prize to $1,000,000,000.00 in the program. Project Specifications Input for this project: Game mode choice – self pick or auto pick Five numbers between 1 and 69 for...
This is for a C# program. I would greatly appreciate any help! Thank you:) For this assignment you're going to create a console application called A02PBallGenerator. This app is going to mimic a quick pick program in a lotto terminal. When the user runs your app you're going to select the numbers for them. Then you'll ask them if they'd like another set of numbers. Y for yes and N for No Use a do while loop so that if...
The Powerball is played by selecting five numbers (without repetition) from the white balls labeled 1 through 69 (the order doesn't matter) and one red ball (the powerball) with label from 1 through 26. You win the grand prize if you get all five white numbers plus the powerball. 3. (a.) How many possible tickets are there? What is the probability of winning the grand prize? (b.) You win $4 if you get the powerball and at most one white...
Please help to solve question 1 and subsections 1-4 1: Powerball Consider the multi-state lottery Powerball game. Each ticket is $2 and allows a player to select 5 white balls from 1 to 69 (without replacement), and 1 Red Powerball, from 1 to 26. The order of the five white balls does not matter when evaluating a win. If there are 64 losing whiteball numbers, how many ways can the winner pick 4 of them. If the player is only...
ASSIGNMENT 5 – POWERBALL SIMULATION Powerball® is a combined large jackpot game and a cash game. Every Wednesday and Saturday night at 10:59 p.m. Eastern Time, we draw five white balls out of a drum with 69 balls (1-69) and one red ball out of a drum with 26 red balls (1-26). Draw sales cut off at least 59 minutes before the draw. Check for local cut-off time. Players win by matching one of the 9 Ways to Win. The...
Python code question - you are given the grand prize(in USD) and the winning numbers. Your program will read multiple tickets (6 selected numbers in each ticket) from the input file. For each ticket, the program calculates its prize won, and outputs the prize (in USD) to the output file. How to Play the Game? In each ticket, the player selects five numbers from a set of 69 white balls (numbered 1 to 69) and one number from 26 red...