def get_permutation(rng, payload_size, image_size):
	"""Return a permutation of indices to permute over the pixels

	Keyword arguments:
	rng -- a random number generator seeded with a password
	payload_size -- the number of elements of the permutation needed
	image_size -- the range of indices to permute over
	
	Performs a Fisher-Yates shuffle of numbers from 1 to image_size
	and returns the first payload_size elements"""
	
	permutation = [i for i in range(image_size+1)]
	
	for i in range(payload_size):
		try:
			rand_ind = rng.randrange(i,image_size+1)
		except ValueError:
			return 0
		permutation[i], permutation[rand_ind] \
		= (permutation[rand_ind], permutation[i])
	#Need only the first payload_size elements
	permutation = permutation[0:payload_size]
	return permutation