所谓硬币:0/1
所谓骰子:0/1/2/3/4/5
int coin(){
return rand()%2;
}
int dice(){
return rand()%6;
}
应用举例
template <typename T>
int Vector<T>::search(T const& e, Rank lo, Rank hi) {
return rand()%2 ? fibSearch(_elem, e, lo, hi) : binSearch(_elem, e, lo, hi);
}