GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   How do you shuffle the lines of a text file? (https://gfy.com/showthread.php?t=818555)

Matt 26z 03-30-2008 01:25 AM

How do you shuffle the lines of a text file?
 
Found some PHP options, but I'd rather paste it into a text box and have javascript do it or something.

just a punk 03-30-2008 01:40 AM

There is no PHP-like shuffle function in JavaScript, so you have to do it like this:
Code:

shuffle = function(myArray) {
        for (var tmp, j, i = myArray.length; i; j = parseInt(Math.random()*i), tmp = myArray[--i], myArray[i] = myArray[j], myArray[j] = tmp);
        return myArray;
};


Tempest 03-30-2008 06:17 AM

Quote:

Originally Posted by Matt 26z (Post 13997042)
Found some PHP options, but I'd rather paste it into a text box and have javascript do it or something.

http://www.lonewolfscripts.com/tools...ize_lines.html

Matt 26z 03-31-2008 08:33 PM

Thanks a lot.

Bump for anyone who wanted to randomize a big list of FHG's.


All times are GMT -7. The time now is 09:39 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123