Information

Author(s) Erik-Jan Lingen, Matthias Möller
Deadline Keine Frist
Submission limit No limitation

Sign in

[OpenMP] Exercise 9 : Random Number Generator

This material is part of the course Practical Introduction to Parallel Programming and meant for educational purposes only.


Task

Write a program that generates random numbers between 0 and 1 and counts how many times the random number is smaller than 0.3. Once the program has found 10 random numbers smaller than 0.3 it should return and print the random numbers found.

Hint

Write a function that generates a single random number and stores it into a global array if the random number is smaller than 0.3. The function should generate a new task if less than 10 random numbers have been found so far.


Question 1: Random Number Generator
Question 2: OpenMP environment variables

Specify the OpenMP environment variables that should be used for running your program (export OMP_NUM_THREADS=1 ...). Use semicolons to separate multiple variables

Question 3: Command Line Argument

Specify the command line arguments that should be passed to your program when it is run. Arguments must be given in quotes and separated by commas. Leave this filed empty if you do not want to specify command line arguments.

Example: "1","int","arg=2" is interpreted as three arguments 1, int, and arg=2.