Hello, schothorst.
i'm sorry. I see I have'nt understood you from the beginning. I have'nt been able to deduce,
merely looking at yours examples (15487632, 12658473, ...), the restriction "but all the
umbers are only allowed one's in de string"...
Well, only I wish know now is if I've understood you at last.
//...
integer li_from_0, li_limit
string ls_number, ls_digit
//Supongo, ya que no se explicita la restricción, que li_limit es, además de la longitud
//deseada del string ls_number, el "límite superior" (véase abajo) de los dígitos aleatorios
//que lo constituyen...
//li_from_0 must be 0 or 1.
//If 0, the digits will be 1, 2, ..., li_limit and 1 <= li_limit <= 9
//If 1, " " " " 0, 1, ..., li_limit - 1 and 1 <= li_limit <= 10
//I think this is the case you wanted initially...
li_from_0 = 0
li_limit = 8
Randomize (CPU ())
ls_number = ""
DO WHILE (Len (ls_number) < li_limit)
ls_digit = String (Rand (li_limit) - li_from_0)
IF (Pos (ls_number, ls_digit) = 0) THEN&
ls_number = ls_number + ls_digit
LOOP
MessageBox ("", ls_number)
//...
First 3 solutions on my PC: 65413827, 47682135, 24316875.
I think, also, it is possible to find an algorithm more efficient...
Only a last question, schothorst: I'm not able to inagine for what demons you want this code...
Cheers.