A algorithm applycation for monte carlo simulation