Conditional probability in PHP -


i want draw random numbers between 1 , 100 in php. want numbers drawn probability of 20%, odd numbers probability of 80%.

how can implement this?

function wtf_random() {   $ret = 2 * rand(1, 50);   if (rand(1, 5) !== 1) {     --$ret;     }   return $ret; } 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -