Question: [25 marks] Libraries for random number generators may only generate uniformly dis- tributed random numbers. Two methods for converting uniformly distributed random numbers to normally
![[25 marks] Libraries for random number generators may only generate uniformly](https://s3.amazonaws.com/si.experts.images/answers/2024/08/66cf327fb6c59_91166cf327f2dae2.jpg)
[25 marks] Libraries for random number generators may only generate uniformly dis- tributed random numbers. Two methods for converting uniformly distributed random numbers to normally distributed random numbers are the Box-Muller method and the polar Marsiglia method. Let uy and uz be two independent random numbers drawn from a uniform distribution on [0,1]. In the Box-Muller method, uj and u2 are converted to two normally distributed num- bers ni and n2 via n = 1-2 ln u, cos(2nu2), n = V-2 ln u sin(2nu2). In the polar Marsiglia method, we compute V = 2u1 - 1, V2 = 2u2 1, w = v + oz. If w > 1, discard the result and try again. Otherwise, set -2 In w -11, -2 In w n2 = V2.02. Write a program that takes an integer N and floating-point numbers A and B generates an array of size N with values that have a Gaussian distribution with mean A and variance B. Which algorithm would be preferred on a distributed architecture? Which algorithm would be preferred on a GPU architecture? [25 marks] Libraries for random number generators may only generate uniformly dis- tributed random numbers. Two methods for converting uniformly distributed random numbers to normally distributed random numbers are the Box-Muller method and the polar Marsiglia method. Let uy and uz be two independent random numbers drawn from a uniform distribution on [0,1]. In the Box-Muller method, uj and u2 are converted to two normally distributed num- bers ni and n2 via n = 1-2 ln u, cos(2nu2), n = V-2 ln u sin(2nu2). In the polar Marsiglia method, we compute V = 2u1 - 1, V2 = 2u2 1, w = v + oz. If w > 1, discard the result and try again. Otherwise, set -2 In w -11, -2 In w n2 = V2.02. Write a program that takes an integer N and floating-point numbers A and B generates an array of size N with values that have a Gaussian distribution with mean A and variance B. Which algorithm would be preferred on a distributed architecture? Which algorithm would be preferred on a GPU architecture
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
