Let $X$ be a uniform random number in $0..n$. Its expected value is $n/2$.
Next, let $Y$ obey a binomial distribution with $X$ trials and success probability $p$. So now we have a distribution where one of the parameters is itself a random variable. I'm not sure how this is called, but it reminds me of composite functions.
Can I compute the expected value of $Y$ simply as $X\cdot p$, and subsitute $n/2$ for $X$, yielding an expected value of $np/2$ for $Y$? If not, how do we compute the expected value of a distribution that has a parameter that is a random variable itself?