A Flask web application that generates deterministic content from any text input. Same input, same output, every time! Visit it at: https://jejis.pythonanywhere.com/
Randomer transforms any text into a variety of unique, deterministic content:
- Dice Rolls: Generate deterministic dice rolls for D3, D5, D6, D8, D10, D12, and D20
- Chess Positions: Create unique chess positions with Stockfish evaluation and best moves
- Color Patterns: Generate harmonious color palettes with RGB, HEX, HSL, HSV, and CMYK formats
- Random Maze: Create solvable mazes using depth-first search algorithm
- Pixel Art: Generate 16x16 pixel art with various patterns and symmetries
- Poker Hands: Draw 5-card poker hands with automatic hand evaluation
- Minesweeper: Play unique Minesweeper layouts with consistent mine placement
- Word Generator: Get random words with definitions in multiple languages
- Minecraft Seeds: Generate Minecraft world seeds with ChunkBase integration
- Abstract Images: Create unique algorithmic art with complex patterns
- Dark/Light Mode: Toggle between themes with persistent preferences
- Responsive Design: Works seamlessly on desktop, tablet, and mobile
- Interactive Elements: Hover effects, animations, and smooth transitions
- Clean Homepage: Overview of all features with easy navigation
- Python 3.7+
- Stockfish chess engine (optional, for chess features)
-
Clone the repository
git clone https://github.com/yourusername/randomer.git cd randomer
-
Install dependencies
pip install -r requirements.txt
-
Install Stockfish (optional)
Stockfish is required for chess position evaluation. Choose your installation method:
macOS:
# Using Homebrew (recommended) brew install stockfish # Using MacPorts sudo port install stockfish # Manual installation # Download from https://stockfishchess.org/download/mac/ # Extract and add to PATH
Ubuntu/Debian:
# Using apt package manager sudo apt-get update sudo apt-get install stockfish # Or download latest version manually wget https://github.com/official-stockfish/Stockfish/releases/latest/download/stockfish_15_linux_x64_avx2.tar.gz tar -xzf stockfish_15_linux_x64_avx2.tar.gz sudo cp stockfish_15_linux_x64_avx2/stockfish_15_linux_x64_avx2 /usr/local/bin/stockfish
CentOS/RHEL/Fedora:
# Using dnf (Fedora) sudo dnf install stockfish # Using yum (CentOS/RHEL) sudo yum install stockfish # Or compile from source sudo yum groupinstall "Development Tools" git clone https://github.com/official-stockfish/Stockfish.git cd Stockfish/src make build ARCH=x86-64-modern sudo cp stockfish /usr/local/bin/
Arch Linux:
# Using pacman sudo pacman -S stockfish # Using AUR yay -S stockfish-git
Windows:
# Using Chocolatey choco install stockfish # Using Scoop scoop install stockfish # Manual installation: # 1. Download from https://stockfishchess.org/download/windows/ # 2. Extract stockfish.exe to a folder # 3. Add folder to PATH environment variable # 4. Or place stockfish.exe in your project directory
Docker (Cross-platform):
# Pull Stockfish Docker image docker pull niklasf/stockfish:latest # Run Stockfish in container docker run --rm -i niklasf/stockfish:latest
Verification:
# Test if Stockfish is properly installed stockfish # Should show Stockfish version and UCI prompt # Type 'quit' to exit
Troubleshooting:
- If
stockfish
command not found, check if it's in your PATH - On Windows, you may need to use full path:
C:\path\to\stockfish.exe
- For permission issues on Linux/macOS:
chmod +x stockfish
- Alternative: Place stockfish binary in the same directory as app.py
- If
-
Run the application
python app.py
-
Open your browser Navigate to
http://localhost:8080
- Visit the homepage at
http://localhost:8080
- Enter any text in the input field
- Click "Generate Content" or press Enter
- Explore all the generated content for your text
You can also access content directly via URLs:
http://localhost:8080/hello
- Generate content for "hello"http://localhost:8080/my-custom-text
- Generate content for "my-custom-text"http://localhost:8080/๐ฎ
- Even emojis work!
Get generated images directly:
http://localhost:8080/image/hello
- Get the generated image for "hello"
Randomer uses cryptographic hashing (SHA-256) to create deterministic seeds from input text. These seeds are then used to initialize Python's random
module, ensuring that:
- Same input always produces same output
- Different inputs produce vastly different outputs
- Content appears random but is completely reproducible
Input Text โ SHA-256 Hash โ Seed โ Random Generator โ Content
import hashlib
import random
text = "hello"
hash_object = hashlib.sha256(text.encode())
seed = int.from_bytes(hash_object.digest(), byteorder='big')
random_gen = random.Random(seed)
# Now random_gen will always produce the same sequence for "hello"
- Supports D3, D5, D6, D8, D10, D12, D20
- Beautiful 3D-styled dice with hover effects
- Color-coded for easy identification
- Generates valid chess positions using proper algorithms
- Integrates with Stockfish for position evaluation
- Shows best moves with visual arrows
- Handles engine errors gracefully
- Creates harmonious color palettes using HSV color space
- Displays complementary colors
- Supports multiple color formats
- Interactive color selection
- Uses depth-first search algorithm
- Always generates solvable mazes
- 15x15 cell mazes with entrance and exit
- Responsive grid layout
- Four different pattern types:
- Symmetrical patterns
- Quarter symmetry
- Radial patterns
- Random walk patterns
- Intelligent color palette generation
- 16x16 pixel resolution
- Full 52-card deck simulation
- Automatic hand evaluation
- Supports all standard poker hands
- Visual card representation with suits
- 10x10 grid with 15 mines
- Interactive gameplay with left/right click
- Mine counter and game status
- Deterministic mine placement
Endpoint | Method | Description |
---|---|---|
/ |
GET | Homepage |
/<text> |
GET | Generate all content for text |
/image/<text> |
GET | Generate image for text |
/health |
GET | Health check endpoint |
- Flask: Web framework
- Pillow (PIL): Image generation and manipulation
- chess: Chess position handling and validation
- requests: API calls for Pokรฉmon and dictionary data
- Stockfish: Chess engine for position evaluation
Flask==2.3.3
Pillow==10.0.1
python-chess==1.999
requests==2.31.0
- Create a generator function that takes
seed_str
as input - Use SHA-256 to create a deterministic seed
- Initialize
random.Random(seed)
for deterministic randomness - Add the generator to the main template
- Color palettes: Modify the HSV ranges in
generate_pixel_art()
- Maze size: Change the
width
andheight
parameters ingenerate_maze()
- Dice types: Add new dice to the
dice
list inget_dice_rolls()
python app.py
# Using Gunicorn
pip install gunicorn
gunicorn -w 4 -b 0.0.0.0:8080 app:app
# Using Docker
docker build -t randomer .
docker run -p 8080:8080 randomer
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
- Follow PEP 8 style guidelines
- Add docstrings to new functions
- Ensure deterministic behavior for all generators
- Test on multiple screen sizes
- Maintain dark/light mode compatibility
- Stockfish engine may fail to initialize on some systems
- Large mazes may be slow to render on older devices
- Some dictionary API calls may timeout
- Sudoku puzzle generator
- QR code generation
- Music note sequences
- ASCII art generation
- Fractal patterns
- Random story generation
- Color scheme exports
- Maze solving animation
This project is licensed under the MIT License - see the LICENSE file for details.
- Stockfish for the chess engine
- PokรฉAPI for Pokรฉmon data
- Free Dictionary API for word definitions
- Chunkbase for Minecraft seed exploration
- Google Fonts for the Roboto Mono font
If you encounter any issues or have questions:
- Check the Issues page
- Create a new issue if your problem isn't already reported
- Provide detailed information about your environment and the issue
Randomer - Making randomness reproducible, one hash at a time! โจ