How to make a chance to sample from the database without random?

Closed due to the fact that the essence of the issue is not clear to the participants of ReinRaus , fori1ton , Pavel Mayorov , ixSci , PashaPash 18 May '15 at 9:57 .

Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • random entry? - Yakovlev Andrey
  • 2
    if (time ()% 2 == 0) {echo "There is a chance!"; ` - lampa
  • @Riolu, According to the rules of the forum, questions should not be limited to the decision or the completion of student assignments. Please clarify what you have done yourself and what did not work out. - Artem
  • no, for example, I have a table attack_pokemons and a field chans a chance from 1 to 100, I need to make this chance work - Riolu
  • Shrek, I can’t think how to do it, except with the help of a random house = ( - Riolu

1 answer 1

$chance = 60; $success = 0; $failure = 0; for ($i = 0; $i < 100; $i++) { ((mt_rand(0, 99) + $chance) >= 100) ? $success++ : $failure++; } echo 'Success: '.$success.', Failure: '.$failure;