MCPcopy Index your code
hub / github.com/praw-dev/praw / counter

Method counter

praw/models/util.py:59–64  ·  view source on GitHub ↗

Increment the counter and return the current value with jitter.

(self)

Source from the content-addressed store, hash-verified

57 self._max = max_counter
58
59 def counter(self) -> int | float:
60 """Increment the counter and return the current value with jitter."""
61 max_jitter = self._base / 16.0
62 value = self._base + random.random() * max_jitter - max_jitter / 2 # noqa: S311
63 self._base = min(self._base * 2, self._max)
64 return value
65
66 def reset(self) -> None:
67 """Reset the counter to 1."""

Calls

no outgoing calls