How to generate a number representing the sum of a discrete uniform distribution

前端 未结 2 444
感动是毒
感动是毒 2021-01-21 03:10

Step 1:

Let\'s say that I want to generate discrete uniform random numbers taking the value -1 or 1. So in other words I want to generate numbers having

2条回答
  •  伪装坚强ぢ
    2021-01-21 03:11

    In general the sum of independent variables has pdf equal to the convolution of the pdfs of the summand variables. When the variables are discrete, the convolution is very conveniently computed via the Matlab function conv (which probably calls fft for a fast, exact calculation).

    When the pdf's are uniform, then the result of the convolution is a binomial or multinomial pdf. But the convolution stuff applies for non-uniform pdfs as well.

提交回复
热议问题