Aufgaben:Exercise 2.7Z: C Program "z3": Difference between revisions
From LNTwww
No edit summary |
Fix interlanguage link: resolve redirect chain |
||
| (2 intermediate revisions by 2 users not shown) | |||
| Line 45: | Line 45: | ||
===Solution=== | ===Solution=== | ||
{{ML-Kopf}} | {{ML-Kopf}} | ||
'''(1)''' <u>All three statements</u> are true. | '''(1)''' <u>All three statements</u> are true. | ||
'''(2)''' The real-valued random numbers $0.75$, $0.19$, $0.43$ and $0.08$ are each compared with $0.25$ | '''(2)''' The real-valued random numbers $0.75$, $0.19$, $0.43$ and $0.08$ are each compared with $0.25$. | ||
*This comparison results in the binary values $1, \ 0, \ 1, \ 0$. | *This comparison results in the binary values $1, \ 0, \ 1, \ 0$. | ||
*This results in the sum $\underline{z3 = 2}$ | *This results in the sum $\underline{z3 = 2}$ for the first call. | ||
'''(3)''' Analogous to the result of the subtask '''(2)''' the binary values $1, \ 1, \ 1, \ 0$ now occur because of the random values $0.99$, $0.32$, $0.53$ and $0.02$ . | '''(3)''' Analogous to the result of the subtask '''(2)''' the binary values $1, \ 1, \ 1, \ 0$ now occur because of the random values $0.99$, $0.32$, $0.53$ and $0.02$ . | ||
*This leads to the output value $\underline{z3 = 3}$ (again sum of binary values). | *This leads to the output value $\underline{z3 = 3}$ (again the sum of binary values). | ||
{{ML-Fuß}} | {{ML-Fuß}} | ||
| Line 62: | Line 62: | ||
[[Category:Theory of Stochastic Signals: Exercises|^2.5 Generation of Discrete Random Variables^]] | [[Category:Theory of Stochastic Signals: Exercises|^2.5 Generation of Discrete Random Variables^]] | ||
[[de:Aufgaben:Aufgabe 2.7Z: C-Programm z3]] | |||
Latest revision as of 17:53, 16 March 2026

a binomial distribution
The C program $z3$ given here successively generates a binomially distributed random variable with the characteristic variables $I$ and $p$.
- It uses the program $z1$ already described and analyzed in Exercise 2.7 .
- Assume that the program is called with parameters $I = 4$ and $p = 0.75$ .
- The first eight real-valued numbers (all between zero and one) generated by the random generator $\text{random()}$ are:
- $$\rm 0.75, \ 0.19, \ 0.43, \ 0.08, \ 0.99, \ 0.32, \ 0.53, \ 0.02.$$
Hints:
- The exercise belongs to the chapter Generation of Discrete Random Variables.
- Reference is also made to the chapter Binomial distribution.
Questions
Solution
(1) All three statements are true.
(2) The real-valued random numbers $0.75$, $0.19$, $0.43$ and $0.08$ are each compared with $0.25$.
- This comparison results in the binary values $1, \ 0, \ 1, \ 0$.
- This results in the sum $\underline{z3 = 2}$ for the first call.
(3) Analogous to the result of the subtask (2) the binary values $1, \ 1, \ 1, \ 0$ now occur because of the random values $0.99$, $0.32$, $0.53$ and $0.02$ .
- This leads to the output value $\underline{z3 = 3}$ (again the sum of binary values).