Implemented Rejection Sample algorithm and an example for it