from itertools import dropwhile, count, cycle
import random


def geometric(p):
    return (next(dropwhile(lambda _: random.randint(1, int(1. / p)) == 1, count())) for _ in cycle([1]))


def uniform(n):
    """
    Simple deterministic distribution for testing internal of the skiplist
    """
    return (n for _ in cycle([1]))

from itertools import dropwhile, count, repeat
import random


def geometric(p):
    return (next(dropwhile(lambda _: random.randint(1, int(1. / p)) == 1, count())) for _ in repeat(1))


# Simple deterministic distribution for testing internals of the skiplist. 
uniform = repeat

Use itertools.repeat over slower alternatives.
Use itertools.repeat over slower alternatives.
- from itertools import dropwhile, count, cycle
+ from itertools import dropwhile, count, repeat
  import random
  
  
  def geometric(p):
-     return (next(dropwhile(lambda _: random.randint(1, int(1. / p)) == 1, count())) for _ in cycle([1]))
+     return (next(dropwhile(lambda _: random.randint(1, int(1. / p)) == 1, count())) for _ in repeat(1))
  
  
- def uniform(n):
-     """
-     Simple deterministic distribution for testing internal of the skiplist
+ # Simple deterministic distribution for testing internals of the skiplist. 
+ uniform = repeat
-     """
-     return (n for _ in cycle([1]))
  
Use itertools.repeat over slower alternatives.
## Code Before:
from itertools import dropwhile, count, cycle
import random


def geometric(p):
    return (next(dropwhile(lambda _: random.randint(1, int(1. / p)) == 1, count())) for _ in cycle([1]))


def uniform(n):
    """
    Simple deterministic distribution for testing internal of the skiplist
    """
    return (n for _ in cycle([1]))

## Instruction:
Use itertools.repeat over slower alternatives.
## Code After:
from itertools import dropwhile, count, repeat
import random


def geometric(p):
    return (next(dropwhile(lambda _: random.randint(1, int(1. / p)) == 1, count())) for _ in repeat(1))


# Simple deterministic distribution for testing internals of the skiplist. 
uniform = repeat
