The following C++ code will do it. Save text as unsort.cc and compile g++ -o unsort unsort.cc Then, if numbers are in a file list unsort < list to "unsort" unsort < list > file to "unsort" and put in a file. #include<iostream> #include<vector> #include<algorithm> using namespace std; int main() { vector<double> numbers; copy( istream_iterator<double>( cin ), istream_iterator<double>(), back_inserter( numbers ) ); random_shuffle( numbers.begin(), numbers.end() ); copy( numbers.begin(), numbers.end(), ostream_iterator<double>( cout, "\n") ); return 0; } You may want to add something to the code to scramble the random number stream befor you do he random shuffle. Alternatively, you might see if perl has a quick way of doing this. JDL Ronald Wiplinger wrote:
Off Topic, but here are more clever people ;-)
I am lookinig for way to "unsort" a list of numbers!!!
E.g., I have a list of numbers, each in a line, but I don't want them in order, it should randomly!
Any hints how to do that. And yes, it must be this numbers and not new numbers ;-)
bye
Ronald
Ronald Wiplinger (ÃQ¤¯¯Ç), CEO, ELMIT - The Solution Provider Tel. +886 2 8809-7980, Fax. +886 2 2809-0183, Mobile: +886 915 653-452
Net2Phone:8869550066, ICQ: 111651169 http://www.elmit.com http://www.wiplinger.org