Booleans arrive from a database as 1, from a CSV as yes, and from a config file as on. A parser that handles one and not the others fails quietly. Generate a batch in each representation and find out which ones yours accepts.
What you can control
- Seven representations covering how booleans actually appear across databases, files and APIs.
- The true rate is a percentage, so you can produce a 95%-true column and see whether a filter still works.
- Nullable mode adds a third state, which is what a SQL
BOOLEAN NULLcolumn really holds. - Bit-string mode packs up to 64 flags per row for testing bitmask handling.
What this is not
The true rate is a probability, not a quota. A batch of ten at fifty per cent will not necessarily contain five of each — increase the count if you need the distribution to converge.
Questions
Why does a boolean need to be nullable?
Because a SQL BOOLEAN NULL column has three states, and code that treats null as false is usually wrong. Unknown is not the same as no.
Does the true rate guarantee the split?
No. It is the probability per row, so small batches vary. Over a few hundred rows it converges on the rate you set.
What is bit-string mode for?
Permission masks and feature flags packed into an integer. Generating them as strings lets you test the unpacking code directly.