Connecting Tech Pros Worldwide Forums | Help | Site Map

generating a string of unique random numbers

Newbie
 
Join Date: Mar 2007
Posts: 29
#1: Feb 8 '08
Hey everyone ... happy Friday ...

I need to generate a string of 11 random numbers, (which in itself is not a problem) however, each needs to be unique in value. Building a tree of logical compares is all well and good, but is there an easier way? I did this years ago in Pascal, and I remember the logic, but not the mechanics.

Is there a shortcut in PHP?

I would appreciate any suggestions.

Be well everyone.

Robert
MarkoKlacar's Avatar
Expert
 
Join Date: Aug 2007
Location: Stockholm, Sweden
Posts: 294
#2: Feb 11 '08

re: generating a string of unique random numbers


Hi Robert,

I don't know how good your php skills are but you can work with the same logic(for the tree) in php. What you need is an array and your functions for balancing, sorting etc.

Helps if the functions are recursive (to be clear, they most certainly have to be...).

Is the point of you script to create a tree in the way that I described or are you looking for a finished solution ready for use?

Cheers
Reply