A random number generation apparatus comprising: a random number acquiring unit adapted to obtain a first sequence that comprises values of digits of a random number represented by a binary number as elements, the random number being a uniform random number; and a logical product arithmetic unit adapted to obtain a third sequence that is the result of an elementwise logical product operation between the first sequence and a second sequence that comprises values of digits of one or more Mersenne numbers p i represented by one or more binary numbers and a zero value as elements, each of the first sequence, the second sequence, and the third sequence being constituted by L elements, wherein: the first sequence comprises a first subsequence; a second subsequence comprised in the second sequence indicates any of the one or more Mersenne numbers p i ; the third sequence comprises a third subsequence that is the result of an elementwise logical product operation between the first subsequence and the second subsequence; and the processes of the random number acquiring unit and the logical product arithmetic unit are executed again when the second subsequence matches the third subsequence, otherwise the third sequence comprising one or more random numbers t i on a factor ring modulo the one or more Mersenne numbers p i is output. a random number acquiring unit adapted to obtain a first sequence that comprises values of digits of a random number represented by a binary number as elements, the random number being a uniform random number; and a logical product arithmetic unit adapted to obtain a third sequence that is the result of an elementwise logical product operation between the first sequence and a second sequence that comprises values of digits of one or more Mersenne numbers p i represented by one or more binary numbers and a zero value as elements, each of the first sequence, the second sequence, and the third sequence being constituted by L elements, wherein: the first sequence comprises a first subsequence; a second subsequence comprised in the second sequence indicates any of the one or more Mersenne numbers p i ; the third sequence comprises a third subsequence that is the result of an elementwise logical product operation between the first subsequence and the second subsequence; and the processes of the random number acquiring unit and the logical product arithmetic unit are executed again when the second subsequence matches the third subsequence, otherwise the third sequence comprising one or more random numbers t i on a factor ring modulo the one or more Mersenne numbers p i is output. the first sequence comprises a first subsequence; a second subsequence comprised in the second sequence indicates any of the one or more Mersenne numbers p i ; the third sequence comprises a third subsequence that is the result of an elementwise logical product operation between the first subsequence and the second subsequence; and the processes of the random number acquiring unit and the logical product arithmetic unit are executed again when the second subsequence matches the third subsequence, otherwise the third sequence comprising one or more random numbers t i on a factor ring modulo the one or more Mersenne numbers p i is output. <EOS>