Faker Data Generator
Generate realistic mock data easily.
How it Works
Faker handles massive algorithmic and locale-specific data mocking rapidly.
It allows seamless CI test configurations.
Source Code
Produces unique users mock profile maps utilizing seeds.
faker_demo.py
Try in Editorfrom faker import Faker
import json
# Initialize faker
fake = Faker()
# Set seed for reproducibility
Faker.seed(42)
def generate_users(count=3):
users = []
for _ in range(count):
profile = mock_profile()
users.append(profile)
return users
def mock_profile():
return {
"id": fake.uuid4()[:8],
"name": fake.name(),
"job": fake.job(),
"address": fake.address().replace('\n', ', '),
"email": fake.company_email(),
"ip": fake.ipv4()
}
mock_data = generate_users(3)
print(json.dumps(mock_data, indent=2))Terminal Output
[
{
"id": "270dbde2",
"name": "Allison Hill",
"job": "Buyer, industrial",
"address": "Unit 2011 Box 5691, DPO AP 03681",
"email": "shannon41@gonzales.com",
"ip": "20.245.106.63"
}, ...
]Real-world Applications
- Database seeding
- Unit testing suites
- Automated QA