Description
Generate bounded set, clear and test operations with exact unsigned words stored in increasing word order and least-significant-bit member positions, using BigInt to avoid signed 32-bit truncation.
An operation trace pairs an ordered request stream with the state after each step. Empty operations, ties, evictions, and boundary indexes are part of the modeled contract rather than incidental display details.
Generate bounded set, clear and test operations with exact unsigned words stored in increasing word order and least-significant-bit member positions, using BigInt to avoid signed 32-bit truncation.
When to use this tool
Use this generator to create reproducible bitset membership operation trace cases from the supplied model or bank. Inspect the returned evidence before using cases in a test or exercise.
How to use the tool and how it works
- Supply universeSize, wordWidth, initialMembers, operations, eventCount in the field shapes below. Set seed when you need an explicit replay.
- Run the tool and correct any input error. For generated controls, distinguish a successful fixture containing an invalid case from failure to generate the fixture.
- Read events, finalWords, finalMembers. Use the conventions below. Keep answer-bearing fields separate when presenting an exercise.
Represent membership internally with a BigInt bit mask, sample set, clear, or test operations on zero-based indexes, and return membership before/after each operation. Serialize words least-significant word first and return sorted final members.1
Delegated operations used for this result: unique. Their calculation or parsing conventions apply to the corresponding result fields.2
| Input field | Meaning and units | Accepted input |
|---|---|---|
| universeSize | Universe Size | Required. Safe integer; minimum 1; maximum 64. |
| wordWidth | Word Width | Required. Safe integer; one of 8, 16, 32. |
| initialMembers | Initial Members | Required. Array of Safe integer; minimum 0; maximum 63.; minimum items 0; maximum items 64. |
| operations | Operations | Required. Array of Text; one of "set", "clear", "test".; minimum items 1; maximum items 3. |
| eventCount | Event Count | Required. Safe integer; minimum 1; maximum 64. |
| seed | Optional numeric seed; takes precedence over context randomness. Without either, use the fixed tool.io default seed. | Optional. Safe integer. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| events | Events | Required. Array of Object; no unknown keys.; minimum items 0; maximum items 64. |
| events[].kind | Kind | Required. Text; one of "set", "clear", "test". |
| events[].index | Index | Required. Safe integer; minimum 0; maximum 63. |
| events[].wasMember | Was Member | Required. Boolean. |
| events[].isMember | Is Member | Required. Boolean. |
| events[].words | Words | Required. Array of Safe integer; minimum 0; maximum 4294967295.; minimum items 0; maximum items 8. |
| finalWords | Final Words | Required. Array of Safe integer; minimum 0; maximum 4294967295.; minimum items 0; maximum items 8. |
| finalMembers | Final Members | Required. Array of Safe integer; minimum 0; maximum 63.; minimum items 0; maximum items 64. |
| randomness | Replay source and normalized 32-bit seed, or null seed for an advancing context source. | Required. Object; no unknown keys. |
| randomness.seed | Optional safe-integer replay seed; normalization and precedence are explained below. | Required. Safe integer. or Null. |
| randomness.source | Source | Required. Text; one of "context", "seed". |
An explicit safe-integer seed takes precedence over injected context randomness and is normalized to an unsigned 32-bit integer. With no seed and no context source, replay uses the fixed tool.io default seed. A context source must return finite values from zero inclusive to one exclusive; its advancing state must be retained separately. randomness records the source and normalized seed, or null for context. These generators are not cryptographic random sources.
{
"input": {
"universeSize": 10,
"wordWidth": 8,
"initialMembers": [
0,
8
],
"operations": [
"set",
"clear",
"test"
],
"eventCount": 3,
"seed": 42
},
"output": {
"events": [
{
"kind": "clear",
"index": 4,
"wasMember": false,
"isMember": false,
"words": [
1,
1
]
},
{
"kind": "test",
"index": 6,
"wasMember": false,
"isMember": false,
"words": [
1,
1
]
},
{
"kind": "set",
"index": 5,
"wasMember": false,
"isMember": true,
"words": [
33,
1
]
}
],
"finalWords": [
33,
1
],
"finalMembers": [
0,
5,
8
],
"randomness": {
"seed": 42,
"source": "seed"
}
}
} Limitations and assumptions
- Repeated set or clear can be a no-op and test never changes state. Word width is a representation convention under the stated bounds, not a memory layout or concurrent atomic-bitset implementation.
- A replay requires the same complete input and implementation. The stated sampling convention applies within its eligible space. A finite draw does not exhaust all possible outputs; repeats remain possible unless a distinct-selection rule is explicit.
- The field tables state structural bounds; cross-field constraints and bounded search or output budgets also apply. Unknown keys are rejected where the object contract disallows them. Input errors are distinct from null fields and deliberate invalid controls in a successful output.
Alternative or Complementary methods
For a supplied example, inspect the returned construction or delegated check directly. To evaluate a consumer, also test cases chosen for its own boundaries; a generated finite corpus does not establish exhaustive coverage.
References
Similar or alternative tools
- Two-Table Cuckoo Hashing Trace Tool
Trace insertion evictions, lookups and deletion in two fixed-size integer-key cuckoo tables using h1(k)=k mod m and h2(k)=floor(k/m) mod m; a kick limit rolls back the insertion and signals rehash-needed, without automatic resizing or hash-quality guarantees.
- Random Circular Buffer Wraparound Trace Generator
Simulate sampled reads and writes with delegated circular indices, explicit next-read head and next-write tail, occupancy, underflow and selected reject-or-overwrite overflow semantics.