Random commentary about Machine Learning, BigData, Spark, Deep Learning, C++, STL, Boost, Perl, Python, Algorithms, Problem Solving and Web Search
Wednesday, July 1, 2009
Transform a dice
You are given a dice with 4 faces, which generate numbers with uniform probability {1, 2, 3, 4}. Generate a number in {1, 2, 3, 4, 5, 6, 7} with uniform probability.
Could y, as calculated below, be uniform?
ReplyDelete1. Throw the dice twice and you get two numbers x1 and x2: x1 = {1,2,3,4} and x2 = {1,2,3,4}
2. If x2=x1 or x2=x1+1:
Calculate y=x1+x2-1
3. Else: do not use the result, goto 1.