code: def exponential(rate: float = 1.0, rng=random) -> float:
      """Sample a random value from a Poisson distribution.
  
      Parameters
      ----------
      rate
      rng
  
      References
      ----------
      [^1]: [Wikipedia article](https://www.wikiwand.com/en/Exponential_distribution#Random_variate_generation)
  
      """
  
      u = rng.random()
  
      # Retrive the λ value from the rate (β): β = 1 / λ
      lmbda = 1.0 / rate
      return -math.log(1 - u) / lmbda
  
imports: from __future__ import annotations
  import math
  import random
label_desc: Use image node_id 2 for calling a global function with example usage: exponential(rate, rng) and returns: unknown