To Mithrandir, Wise_guy: I was thinking that he would want to know how such an algorithm worked rather than blindly trusting a black box such as the standard functions. I know its not even close to the best code, but I wrote it when I was 12, so that would explain its quality. I don''t use it anymore, but it is still in my library as a feature I havent gotten around to removing.
"The computer programmer is a creator of universes for which he alone is the lawgiver...No playwright, no stage director, no emperor, however powerful, has ever exercised such absolute athority to arrange a stage or a field of battle and to command such unswervingly dutiful actors or troops." - Joseph Weizenbaum-Brent Robinson
No problem. I hope you didn''t take offence, cos none was intended. I just saw the wheel being reinvented and then your signature and put two and two together..... =)