A Cambria-themed web application that generates cryptographically secure random numbers using Python's secrets module. Features a responsive, pixel-art style interface inspired by the Cambria aesthetic.
- Cryptographically secure random number generation
- Cambria-themed UI with pixel art styling
- Configurable number range and roll count
- Responsive design that works on all devices
- Rate limiting
- Python 3.x
- Flask 3.0.0
- Additional dependencies listed in
requirements.txt
- Clone the repository
- Set up the virtual environment:
.\setup.bat- Activate the virtual environment:
venv\Scripts\activate.bat- Start the application:
python app.py- Open your browser and navigate to:
http://127.0.0.1:5000
- Enter your desired maximum number (1 or greater)
- Choose how many numbers you want to generate (1-100)
- Click "Roll the Dice"
- View your randomly generated numbers
- Cryptographically secure random generation using
secretsmodule - Rate limiting (10 rolls per minute, 50 per hour, 200 per day)
- Input validation and sanitization
- Error handling and logging
The application is built with:
- Flask for the backend
- JavaScript for frontend interactions
- CSS for Cambria styling
- Google Fonts (MedievalSharp)
- URL:
/generate - Method:
POST - Body:
{ "maxRange": 365, // Maximum number (inclusive) "count": 24 // How many numbers to generate } - Response:
{ "numbers": [1, 2, 3], // Generated numbers "success": true, "count": 3, "maxRange": 365 }
- Development:
python app.py- Production (using Gunicorn):
gunicorn wsgi:app- 10 rolls per minute
- 50 rolls per hour
- 200 rolls per day
.
├── app.py # Main Flask application
├── random_generator.py # Random number generation logic
├── requirements.txt # Project dependencies
├── setup.bat # Setup script for Windows
├── wsgi.py # WSGI entry point
├── static/ # Static files
│ └── images/ # Images including logo
└── templates/ # HTML templates
└── index.html # Main page template