June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
|
|
@ -0,0 +1,19 @@
|
|||
Public Sub Main()
|
||||
Dim sSorted As String = "123456789" 'The desired outcome
|
||||
Dim sTest, sChr As String 'Various strings
|
||||
Dim iCounter As Integer 'Loop counter
|
||||
|
||||
Do
|
||||
Inc iCounter 'Increase counter value
|
||||
Repeat 'Repeat
|
||||
sChr = Chr(Rand(49, 57)) 'Get a random number and convert it to a character e.g. 49="1"
|
||||
If Not InStr(sTest, sChr) Then sTest &= sChr 'If the random character is not in sTest then add it
|
||||
Until Len(sTest) = 9 'Loop until sTest has 9 characters
|
||||
Print sTest 'Print the string to test
|
||||
If sTest = sSorted Then Break 'If sTest = sSorted then get out of the loop
|
||||
sTest = "" 'Empty sTest and try again
|
||||
Loop
|
||||
|
||||
Print "Solved in " & Str(iCounter) & " loops" 'Print the result
|
||||
|
||||
End
|
||||
Loading…
Add table
Add a link
Reference in a new issue