Note I don't want to use pythons shuffle as that uses the Fisher-Yates Shuffle algorithm I want to get the same result on both php and python when the seed (random.seed/srand) is the same
My current code is:
def PHP_shuffle(string):
array = list(string)
shuffled_array = []
arr_length = len(array)
if(arr_length < 2):
return array
while(arr_length):
rand_key = array_keys(array[randint(0, arr_length)]
shuffled_array[rand_key] = array[rand_key]
del array[rand_key]
return shuffled_array
It does not work because array_keys is not in python I think I need to port it somehow.