0

Let me take a very small example of what I am looking for.

def add_two_numbers(x, y): return x + y

I want to input n number of times, the random values for x and y.

Is there any python fuzzing library that I can use for generating such values (integers, strings, alphanumeric, etc.)

If you guys can suggest a few python libraries that can be used for to generate random data (fuzzing).

1 Answers1

-1

Random is a library with a bunch of useful features, here's some of the features.

import random
num = random.randint(1,100) # generates a random whole number between 1 and 100
print(num)
num = random.random() # generates a random float number less than 1
print(num)
num = random.uniform(1,100) #generates a random float number between 1 and 100
print(num)
num = random.uniform(1,999) #generates a random float number between 1 and 100
num = round(num, 2) #rounds that number to two decimal places
print(num)
  • Your answer is limited to numbers whereas the question also mentions alphanumeric. – 0x0fba Nov 14 '22 at 13:06
  • @0x0fba But their example code is for adding two *numbers*. I'd guess they accepted alphanumeric because they were planning on producing numbers using these. – hopperelec Nov 14 '22 at 14:05
  • @0x0fba random can be used to generate letters too... for example if you just save the letters of the alphabet to numbers and generate an integer, a randomly generated 3 would be 'c' – Thomas Hall Dec 05 '22 at 11:12