![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I am looking for a possible algorithm that can generate all sequences of numbers formed by the 10 basic numeric figures: 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9. It is essential that, in all formed combinations, no digit is repeated and that all of them are used. Please help in any way you can. Thank you. |
#3
| |||
| |||
|
|
Brute force function... FUNCTION randnum LPARAMETERS tcDigits, tnLen IF PARAMETERS()=0 tcDigits = "0123456789" ENDIF IF PARAMETERS() <2 tnLen = LEN(tcdigits) ENDIF LOCAL lcNumber AS STRING,lnNumber AS INTEGER , x AS INTEGER, lcDigit lcNumber = "" FOR x = 1 TO tnLen lcDigit = SUBSTR(tcDigits,INT(RAND()*LEN(tcDigits))+1,1) tcDigits = STRTRAN(tcDigits,lcDigit,"") lcNumber = lcNumber + lcDigit ENDFOR RETURN eval(lcNumber) ENDFUNC |
![]() |
| Thread Tools | |
| Display Modes | |
| |