4 ms·
> I suppose, if you're particularly worried about the one-node situation This algorithm doesn't work if you have multiple nodes, so I don't think any other sit
by daveFNbuck 8y ago
> I suppose, if you're particularly worried about the one-node situation
This algorithm doesn't work if you have multiple nodes, so I don't think any other situation is relevant here.
> There's no particular reason to make the fields separate. If you mask out the top bit of the random number then they can share and also make overflow effectively impossible
Yes, this is what I meant by reserving some bits.
> It's also worth noting that there are two bits that go completely unused. They could eat overflow if the layout was slightly rearranged.
Yeah, it's super weird they didn't do that. I guess they just really like having a power of two number of bits.
- Dylan16807 8y ago> This algorithm doesn't work if you have multiple nodes Then what's the random part for? > Yes, this is what I meant by reserving some bits. What I'm saying is, if you separate it out into an increment-field and a random-field, then you need a lot of bits and you need to fundamentally change how it works. If you merely make sure your random number starts below some threshold, you only need 1 bit, or a small fraction of a bit. You would still increment the random number, but you wouldn't have to worry about hitting the max value if you always start between 0 and 2^79.9, for example.
- daveFNbuck 8y ago> Then what's the random part for? It's for multiple nodes, which is why this algorithm doesn't make any sense for their use case.