1.
The stupidest thing is to make every situation clear (that is, to get 0, 1, 2, 3, 4, 5, 6, 7 pointing to the ball) [Hypergeometric distribution calculation formula: p(x=r)=(Cm
r*CN-M
N-r)/CNn, "c" is the combination number, and m and r are subscripts and superscripts respectively. Then write a probability distribution table, multiply P(x=r) of each vertical line by r, and add the results to get the expected value.
2.
There is also a simple formula, e (x) = (n * m)/n)/n.
[where x is the number of specified samples, n is the sample size, m is the total number of specified samples, and n is the total number of individuals in the population], the average value can be obtained directly.
Variance also has two algorithms (both formulas):
1. let the expected value be a, then the variance v (x) = (x1-a) 2 * p1+(x2-a) 2 * p2+...+(xn-a) * pn.
2. The other is v (x) = x12 * p1+X22 * P2+... Xn2 * PN-A2.
[Here also let A be the expected value]