'The infinite monkey theorem states that a monkey hitting keys at random on a typewriter keyboard for an infinite 'amount of time will almost surely type a given text, such as the complete works of William Shakespeare.
'Let´s test it with a console apllication on VB.
'As computers have problems understanding «infinite amount of time», the cycle will repeat it for a googolplex 'number of cycles, being googolplex a constant defined somewhere else.
'I did a research and someone states that the bible has 5M chars, so i think a text variable for that will be able to
'memorize a good work for shakespeare, though thar a 5M chars variable will be a impossible variable.
'Let´s test it with a console apllication on VB.
'As computers have problems understanding «infinite amount of time», the cycle will repeat it for a googolplex 'number of cycles, being googolplex a constant defined somewhere else.
'I did a research and someone states that the bible has 5M chars, so i think a text variable for that will be able to
'memorize a good work for shakespeare, though thar a 5M chars variable will be a impossible variable.
Dim SymbolsonShakespeare, Shakespeareneverwritten_impossiblevariable As String
Dim SymbolsonShakespeare_len, randomsymbol_pos As Integer
Dim work, workletter as googolinteger
Dim randomsymbol As Char
SymbolsonShakespeare = "ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 1234567890 ,.!?:;-()«»"
SymbolsonShakespeare_len = Len(SymbolsonShakespeare)
For work = 0 To googolplex
Shakespeareneverwritten_impossiblevariable = ""
For workletter = 0 To 5000000
randomsymbol_pos = Int(Rnd() * SymbolsonShakespeare_len) + 1
randomsymbol = Mid(SymbolsonShakespeare, randomsymbol_pos, 1)
Shakespeareneverwritten_impossiblevariable = Shakespeareneverwritten_impossiblevariable + randomsymbol
Next
System.Console.Write("Random Work of Shakespeare Monkey: " + vbCrLf)
System.Console.Write(Shakespeareneverwritten_impossiblevariable + vbCrLf)
Next