import random


def GenerateRandomInRange(range, prev=None):
  """Generates random value in range.

  Args:
    range: dict, A range descriptor:
      {start: Value, stop: Value, opt step: Value}
    prev: unused.
  Returns:
    int or float, Random value.
  """
  start, stop = range['start'], range['stop']
  if type(start) == float or type(stop) == float:
    return random.uniform(start, stop)
  if 'step' in range:
    return random.randrange(start, stop, range['step'])
  return random.randint(start, stop)