DEV Community

Cover image for Can you quickly shuffle the index of a trillion documents without conflict?
hmmhmmhm
hmmhmmhm

Posted on

Can you quickly shuffle the index of a trillion documents without conflict?

Recoon

Peter quill: Hey, i have a big problem, last year i wanted to keep the post url in my message board short, so i used an incremental index to create a number for every post that comes up, and now i need to hide it, but i still want it to be short, how do i do that?

Rocket: It's no big deal, just use psuedo-shuffle.js in the middle, it'll take 4 lines, Don't say you can't make it to the gym tonight bro.

Above conversation is an example of what I've been through before. 😅 And I've created a little library that can come in handy when you want to hide the numbering of posts on the web, starting from 1 and going up, to make it look random!


👉 Psuedo-Shuffle.js 👈


Just try it!

Open the index.js file and try to modify it yourself, put in the range and index you want and notice that the value keeps changing as you change it.

Top comments (0)