dimanche 14 mars 2021

How to generate a random boolean *function* (not a random boolean *value*)? [duplicate]

Where A, B and C are bit strings of length N, I would like to sample the space of all deterministic functions of the form

f(A,B) --> C

Put a second way (to aid clarity, I hope!) I'd like to have a Python function get_func that returns a randomly generated function of the form

def fn(A,B) :
    ... ## combines bitstrings A and B in some way to produce bitstring C
    return C

and ideally, get_func should have an equal possibility of selecting any one of the distinguishable possible functions of this form.

I don't know where to begin beyond this specification! Any tips would be most welcome.




Aucun commentaire:

Enregistrer un commentaire