![]() |
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? |
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. |
<?php
randomize OzMan's text! ?php> j/k, I have no idea, but if that works, cheers man! |
: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 |
Quote:
|
Quote:
anyone else? |
|
simple code, and im not a programmer. assign em each a variable, randomize the lot, order from least to greatest.. or somethin
|
PHP Code:
|
You can use Excel and put your text in column A and then use the rand function in column B then sort.
|
elistpro ;)
|
Quote:
|
#!/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[$_]; } |
$filename = "ban.txt";
$sites = file($filename); srand ((double) microtime() * 1000000); $a = rand(0, sizeof($sites) - 1); echo $sites[$a]; |
in ban.txt put a list on each line
|
Interesting ideas here Thanks for the info :thumbsup
|
elistpro
or textpad I think does it .. and it's free |
Quote:
|
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