Home › Forums › JavaScript › Making random not so random › Reply To: Making random not so random
Here I’ve simply used the ‘randomisers’ for x and y from the site you linked to, they account for window dimensions :
http://jsfiddle.net/rnayzkrs/15/
Note I used a value of 400 for x to make sure the number is bigger than the width of the boxes. That way the text will never be wrapped. You may want to use a different value for the actual application. I’d run the function on resize as well so the elements will never create a scrollbar.
As far as them being evenly spread out, I don’t see any indication that this has been purposely done. I think there are just enough folders there so that it appears that way. I’m sure if you click on ‘random’ enough times (could take a while), some configuration will end up being a big cluster in the center (for example). You should get the same effect when you’ve added enough items.
Edit – only thing is that I added some Jquery. That would need a bit of rewriting if you want to stick with plain JavaScript.