Not to make your work seem trivial, but this is almost too simple to be useful as a library. It's already easy enough to set a variable to a random value and check the result as a condition in an If/Then/Else function...
My Projects:
Malum Ruina: SC2Mapster
Eternal Exile: SC2Mapster
Spine Crawler Madness: SC2Mapster
Xeno Crisis: SC2Mapster

electricprism AuthorI wrote a simple function where you can determine whether or not to execute some code based on a percentage chance 0% - 100%.
In order to test it out type "-chance" into the chat area during game play. The two "UI - Display" actions will need to be disabled or deleted outside of demoing.
Download