Shuffling Tehniques

It’s true that we cannot generate pure random numbers, although the proposes to provide true random, I wonder how they overcome the modulo division defect!

Shuffling is one technique that we use every day when playing music. Which is obviously achieved through random numbers. We have to generate random numbers n times where n is the size of the array. A naive approach to shuffle a list would be like

But the true randomness is not always favored, we need the songs to be biased based on our like. So i came up with a solution, somewhat look like this one

here the input i have taken is not same as the one before(regarding the notion). here the array is ranks of the songs based on listen count. I don’t know whether it’s an efficient but it surely does the job of playing more times the song whose listen count is more and the opposite for songs whose listen count is low. It’s MY ALGORITHM


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s