samedi 17 septembre 2016

Randomely creating a boolean function of N boolean variables

I want to write a program for randomely creating a function that receives as an input N binary values, and maps them into one binary value. The naïve approach would be to create all 2^(2^N) such functions, represented as truth tables, and choose one at random - but this is impractical for large N. In addition, as representing the chosen function in truth table is memory inefficient, it would be desirable to represent it as a formula y = f(x1,x2,...,xN).

Thanks!




Aucun commentaire:

Enregistrer un commentaire