randomsampling from stdin