Update counter.py

Added random tie-breaking and chance of repeated events, and documentation.