I have a array
which contains 40
elements like this
$i = array('1','2','3','4','5','6','7','8','9','10','11',
'12','13','14','15','16','17','18','19','20','21','22','23','24',
'25','26','27','28','29','30','31','32','33','34','35',
'36','37','38','39','40');
now i have 4
variations like 5%, 10%, 15%, 20%
The requirement is i need to take array values
randomly after subtracting the desired variation
.
Lets say i used 5%
variation so i need to separate 5%
from the array ie 2
elements i need to remove randomly from the array and keep the rest 38
element in a new array
randomly.so both the resulted array
as well subtracted elements need to be in two different array
.
I need a function with two parameter ie one is variation
and another is required array
ie resultant array
or subtracted elements array
.
This same sequence follows to all other variations.
Aucun commentaire:
Enregistrer un commentaire