added memmapping to rejection sampling for memory efficiency