对于装水的池子, 当池子满的时候,每倒入一滴水就有一滴水被替换
int getRandom() { int c = -1, n = 0; for( auto p = h; p; p = p->next ) { n++; if( rand() % n == 0 ) c = p->val; } return c; }