Simple example - doesn't seem ordered
theogravity opened this issue · 1 comments
theogravity commented
I'm getting results that are out of order:
const TIMESTAMP = Date.now();
const data = [
TIMESTAMP, // 1quOkfPXJlP8398OOPw3ZAdU1Ud
TIMESTAMP + 1, // 1quOkbqQvXWaG1jRZJ8gT7SR5TS
TIMESTAMP + 2 // 1quOkgOFUU6rEapMcojkPREdr7v
].map((timestamp) => KSUSID.randomSync(timestamp).string) ;
The sort order looks like this:
1quOkbqQvXWaG1jRZJ8gT7SR5TS <-- TIMESTAMP + 1
1quOkfPXJlP8398OOPw3ZAdU1Ud <-- TIMESTAMP
1quOkgOFUU6rEapMcojkPREdr7v <-- TIMESTAMP + 2
(1, 0, 2)
vs 0, 1, 2 or 2, 1 , 0
Am I doing something wrong here?
theogravity commented
Realized that k-sorting doesn't necessarily mean complete ordering.
This helped my understanding a bit