but there is no guarentee that will be a completely unique set from the first set. If I needed 2 sets of 500 .. i could just run array_rand(Array, 1000) and split the array in half.
But what if i need a set of 500, and a set of 200 or something like that
Use array_rand() in loops to fetch a single random key each loop iteration. Use that key to push the value to your destination array and remove that value from the original array.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.