Skip to content

Kivooeo/Rust-infinite-monky-simulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust-infinite-monky-simulator

Background:

Ever had a 4 am epiphany about the Infinite Monkey Theorem? That was me, wondering if this proverbial monkey could actually type anything. I got curious about how long it might take to generate something as simple as the minimal code to successfully execute cargo run. I couldn't wait — I tried for about 4-5 hours before I hit my limit.

Motivation:

Maybe you've pondered the idea of completely random generation using a good old monkey and wondered how long it would take to recreate your favorite phrase using pseudorandom number generation.

How it looks -- Examles:

Log file:

[Times:  0] ::: [Attemp at this time: 1      ] ::: [Current text: f            ] ::: [Current time: 29/12/2023 03:01:48]
[Times:  0] ::: [Attemp at this time: 3      ] ::: [Current text: fn           ] ::: [Current time: 29/12/2023 03:01:48]
[Times:  0] ::: [Attemp at this time: 42     ] ::: [Current text: fn           ] ::: [Current time: 29/12/2023 03:01:48]
[Times:  0] ::: [Attemp at this time: 2938   ] ::: [Current text: fn m         ] ::: [Current time: 29/12/2023 03:01:49]
[Times:  0] ::: [Attemp at this time: 77939  ] ::: [Current text: fn ma        ] ::: [Current time: 29/12/2023 03:01:59]
[Times:  0] ::: [Attemp at this time: 103591 ] ::: [Current text: fn mai       ] ::: [Current time: 29/12/2023 03:02:02]

Terminal output:

attemps: 34076 ::: max: fn ::: time: 29/12/2023 03:04:18
attemps: 34077 ::: max: fn ::: time: 29/12/2023 03:04:18
attemps: 34078 ::: max: fn ::: time: 29/12/2023 03:04:18
attemps: 34079 ::: max: fn ::: time: 29/12/2023 03:04:18
attemps: 34080 ::: max: fn ::: time: 29/12/2023 03:04:18
attemps: 34081 ::: max: fn ::: time: 29/12/2023 03:04:18
attemps: 34082 ::: max: fn ::: time: 29/12/2023 03:04:18

Important things:

  • To generate your own phrases, modify the constants within the source code.
  • You can also alter the path and name of the log file.
  • Remember to change the alphabet of unique symbols used in your desired phrase. You can utilize the built-in function create_alphabet for this purpose.

Contributing:

I'll be thrilled if you:

  • aim to enhance the code's quality and readability
  • propose new and interesting functionalities

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages