DEV Community

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

Posted on

1 1 1 1 1

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.

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

Top comments (0)

SurveyJS custom survey software

JavaScript Form Builder UI Component

Generate dynamic JSON-driven forms directly in your JavaScript app (Angular, React, Vue.js, jQuery) with a fully customizable drag-and-drop form builder. Easily integrate with any backend system and retain full ownership over your data, with no user or form submission limits.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay