added sample with replacement for c-standard i/o routines