gets a value in the given range, if the range is a number, the source is returned, if the range is an object, a random value is returned