Open daemontus opened 9 months ago
Note that this approach has the issue that larger networks have a bigger chance of collision, since fewer bits are used for the seed. Alternatively, we could just use u64
instead of usize
and then use upper 32 bits for the seed and lower 32 bits for variable index. This would limit us to 2^32 variables, but that is more than enough at this point.
Right now,
Id
objects are just indices. As such, the same ID object is valid in two differentBooleanNetwork
objects. This can lead to accidents if multiple networks are used in the same context.A possible way to fix this is to add a randomized
usize
"seed" to each BN object, and then xor this seed with every index to produce an ID. We can then xor the ID with the seed again to decode the original index. If the ID is produced using a different "seed", it is extremely likely that this decoding will produce an index which is not valid in this particular BN.