#exercises

算法导论(Introduction to Algorithms)exercises 5.1-3代码实现Unblased_random

intblased_random(){//返回1的概率为0.1,返回0的概率为0.9;returnrand()%10>8?1:0;}intunblased_random(){//等概率返回1,0;inta=0,b=0;for(;a==b;a=blased_random(),b=blased_random());r...