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)
-   -   Best way to randomize a text list??? (https://gfy.com/showthread.php?t=445809)

OzMan 03-18-2005 11:55 PM

Best way to randomize a text list???
 
I have a text file of the form:

word1
word2
word3
word4
word5
etc

and I want something that will randomly change the order, for example:

word3
word1
word5
word2
word4

Any suggestions?

smack 03-19-2005 12:05 AM

what language do you want to use?

in VB i would just have a randomize statement run from the lbound to the ubound of the array and write them to a different file.

newbreed 03-19-2005 12:09 AM

<?php

randomize OzMan's text!

?php>



















j/k, I have no idea, but if that works, cheers man!

OzMan 03-19-2005 12:13 AM

:winkwink: I just want a simple desktop app like textpad or something.

There are a bunch that will sort a file .. alpha numeric ascending descending etc but I wanna do the opposite I guess :helpme

Crypt 03-19-2005 12:15 AM

Quote:

Originally Posted by OzMan
:winkwink: I just want a simple desktop app like textpad or something.

There are a bunch that will sort a file .. alpha numeric ascending descending etc but I wanna do the opposite I guess :helpme

ListMate ;)

OzMan 03-20-2005 01:51 AM

Quote:

Originally Posted by Crypt
ListMate ;)

checking that out , Thanks :thumbsup

anyone else?

2HousePlague 03-20-2005 01:55 AM

Is this for ENCRYPTION purposes?

If so, try this...


j-

Explicit 03-20-2005 02:00 AM

simple code, and im not a programmer. assign em each a variable, randomize the lot, order from least to greatest.. or somethin

xl11 03-20-2005 02:26 AM

PHP Code:


<?

$data = file('data.txt');

shuffle($data);

foreach ($data as $value) {

   echo "Value: $value<br />\n";

}
?>


The Sultan Of Smut 03-20-2005 03:00 AM

You can use Excel and put your text in column A and then use the rand function in column B then sort.

Dirty F 03-20-2005 03:04 AM

elistpro ;)

Explicit 03-20-2005 03:18 AM

Quote:

Originally Posted by xl11
PHP Code:


<?

$data = file('data.txt');

shuffle($data);

foreach ($data as $value) {

   echo "Value: $value<br />\n";

}
?>


wow, i was pretty damn close ehh, thanks for the visual.

bbe 03-20-2005 03:19 AM

#!/usr/bin/perl

# Read File
while (<>) {
push(foo, $_);
}

# Shuffle lines
srand;
for (0..$#foo) {
$r = rand($#foo+1);
($foo[$r], $foo[$_]) = ($foo[$_], $foo[$r]);
}

# Print it out
for (0..$#foo) {
print $foo[$_];
}

fris 03-20-2005 04:38 AM

$filename = "ban.txt";
$sites = file($filename);
srand ((double) microtime() * 1000000);
$a = rand(0, sizeof($sites) - 1);
echo $sites[$a];

fris 03-20-2005 04:39 AM

in ban.txt put a list on each line

OzMan 03-20-2005 11:29 AM

Interesting ideas here Thanks for the info :thumbsup

KRosh 03-20-2005 11:32 AM

elistpro


or textpad I think does it .. and it's free

WebTitan 03-20-2005 12:38 PM

Quote:

Originally Posted by The Sultan Of Smut
You can use Excel and put your text in column A and then use the rand function in column B then sort.

was going to be my suggestion :thumbsup


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

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