how make special random array. i have array(1=>35,2=>25,3=>40)
. how make possibility that array show special elements. Ex.
If i want get 100 elements from array. it will be
35/100 +-10 - must bee 1 element,
25/100 +-10 = must be 2 element,
40/100 +-10 - must be 3 element.
Elemanlar rasgele olabilir, ama en çok elemanları + -10 gerekir. ben bu kodu ile olası markasını biliyor:
$a = array_fill(1, 35, 1);
$b = array_fill(36, 60, 2);
$c = array_fill(61, 100, 3);
array looks like array(35 elements with value 1, 25 elements with value 2, 40 elements with value 3)
and using merge and array_rand i will get my code. But i don't want this code. it will be create 100 items. need optimization this code. it's possible. help. :-)