Returns a random integer (for a Django IntegerField)
557697
def integer(anon, obj, field, val):
    
    return anon.faker.integer(field=field)
47932
def _get_random_id():
    
    symbols = string.ascii_uppercase + string.ascii_lowercase + string.digits
    return ''.join(random.choice(symbols) for _ in range(15))
20682
def rrandom():
    """"""
    import urllib.request
    import urllib.error
    import urllib.parse
    if checkquota() < 1:
        raise Exception("Your www.random.org quota has already run out.")
    request = urllib.request.Request(
        'http://www.random.org/integers/?num=1&min=0&max=1000000000&col=1&base=10&format=plain&rnd=new')
    request.add_header('User-Agent', 'randomwrapy/0.1 very alpha')
    opener = urllib.request.build_opener()
    numlist = opener.open(request).read()
    num = numlist.split()[0]
    return float(num) / 1000000000
528827
def random_int(maximum_value):
	
	if maximum_value == 0:
		return 0
	elif maximum_value == 1:
		return random_bits(1)

	bits = math.floor(math.log2(maximum_value))
	result = random_bits(bits) + random_int(maximum_value - ((2 ** bits) - 1))
	return result
453403
def randbelow(num: int) -> int:
    
    if not isinstance(num, int):
        raise TypeError('number must be an integer')
    if num <= 0:
        raise ValueError('number must be greater than zero')
    if num == 1:
        return 0

    # https://github.com/python/cpython/blob/3.6/Lib/random.py#L223
    nbits = num.bit_length()    # don't use (n-1) here because n can be 1
    randnum = random_randint(nbits)    # 0 <= randnum < 2**nbits
    while randnum >= num:
        randnum = random_randint(nbits)
    return randnum
941251
def django_field_to_index(field, **attr):
    '''
    
    '''

    dj_type = field.get_internal_type()

    if dj_type in ('DateField', 'DateTimeField'):
        return DateField(**attr)
    elif dj_type in ('BooleanField', 'NullBooleanField'):
        return BooleanField(**attr)
    elif dj_type in ('DecimalField', 'FloatField'):
        return NumberField(coretype='float', **attr)
    elif dj_type in ('PositiveSmallIntegerField', 'SmallIntegerField'):
        return NumberField(coretype='short', **attr)
    elif dj_type in ('IntegerField', 'PositiveIntegerField', 'AutoField'):
        return NumberField(coretype='integer', **attr)
    elif dj_type in ('BigIntegerField'):
        return NumberField(coretype='long', **attr)

    return StringField(**attr)
325964
def random(self, length=4):
        """"""
        if not isinstance(length, int):
            raise TypeError('DigitWord can only be randomized by an integer length')

        if self.wordtype == DigitWord.DIGIT:
            self._word = [Digit(random.randint(0, 9)) for i in range(0, length)]
        elif self.wordtype == DigitWord.HEXDIGIT:
            self._word = [HexDigit(str(hex(random.randint(0, 15))).replace('0x',''))
                          for i in range(0, length)]
        else:
            raise TypeError('wordtype is invalid.')
285399
def acts_as_random_id(options={:field => :id}, &block)
      before_create do |record|
        if block
          record.ensure_unique_id(options, &block)
        else
          record.ensure_unique_id(options) do
            rand(2_147_483_647) + 1 # mysql and SQLite type integer
          end
        end
      end
    end
581776
function randint(from, to) {
		return Math.round(Math.random() * (to - from) + from);
	}
1220481
function randomNumber() {
  var min = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
  var max = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1000;

  return Math.floor(Math.random() * (max - min + 1)) + min;
}
1152860
def random_alphanum(length):
    
    charset = string.ascii_letters + string.digits
    return random_string(length, charset)
643213
function getRandomNumber(min, max) {
  return Math.round(Math.random() * (max - min) + min);
}
1081803
def randomBinaryField(self):
        
        lst = [
            b"hello world",
            b"this is bytes",
            b"awesome django",
            b"djipsum is awesome",
            b"\x00\x01\x02\x03\x04\x05\x06\x07",
            b"\x0b\x0c\x0e\x0f"
        ]
        return self.randomize(lst)
522272
def positive_small_integer(anon, obj, field, val):
    
    return anon.faker.positive_small_integer(field=field)
671795
def randbetween(ctx, bottom, top):
    
    bottom = conversions.to_integer(bottom, ctx)
    top = conversions.to_integer(top, ctx)
    return random.randint(bottom, top)
897028
@Override
    public Randomizer<?> getRandomizer(Field field) {
        if (field.isAnnotationPresent(org.jeasy.random.annotation.Randomizer.class)) {
            org.jeasy.random.annotation.Randomizer randomizer = field.getAnnotation(org.jeasy.random.annotation.Randomizer.class);
            Class<?> type = randomizer.value();
            RandomizerArgument[] arguments = randomizer.args();
            return ReflectionUtils.newInstance(type, arguments);
        }
        return null;
    }
1314834
def random_digit_not_null_or_empty(self):
        
        if self.generator.random.randint(0, 1):
            return self.generator.random.randint(1, 9)
        else:
            return ''