For this method, i have to randomly generate a new job with random priority and execution time. The chances of creating a new job is equal to PERCENT_NEW_JOB which is 6. Im not sure on how to create a new job with a random chance of actually creating. heres the code
/*Randomly generates a new job with random priority and execution time.
* The chances of creating a new job is equal to PERCENT_NEW_JOB.
* after the creation the job is placed in the waitingJobs queue.
*/
public static void generateJobs(int clock)
{
int randomPriority = Math.abs(generator.nextInt()) % 4 + 1;
int randomExecutionTime = Math.abs(generator.nextInt()) % 10 + 1;
Job job = new Job(randomPriority, randomExecutionTime, clock);
waitingJobs.offer(job);
}
