lundi 14 décembre 2020

Hash function that maps to +-1

I'm trying to generate a random hash function in python that maps every element in a list (without a known range) to {-1,1} and I'm a struggling.

I found np.random.choice that answers the range of the mapping (+-1), but it might not map the same element to the same value (it isn't an hash function). How can I do this right?

Thanks in advance




Aucun commentaire:

Enregistrer un commentaire