Some kind of Monte-Carlo algorithm