Implement the following method using the Fork/Join Framework to assign random values to the list. public static
Question:
Implement the following method using the Fork/Join Framework to assign random values to the list.
public static void parallelAssignValues(double[] list)
Write a test program that creates a list with 9,000,000 elements and invokes parallelAssignValues to assign random values to the list. Also implement a sequential algorithm and compare the execution time of the two. Note that if you use Math.random(), your parallel code execution time will be worse than the sequential code execution time because Math.random() is synchronized and cannot be executed in parallel. To fix this problem, create a Random object for assigning random values to a small list.
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Related Book For
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang
Question Posted: