Skip to main content

Quantum-inspired Random Number Generator (QRNG) for Python

Project description

🌌 Quantum RNG

A high-performance quantum-inspired random number generator that leverages quantum mechanical principles in classical computing environments. This library simulates quantum phenomena on classical hardware to generate high-quality random numbers with proven entropy characteristics.

✨ Features

  • Quantum-inspired random number generation using simulated quantum effects:
    • Quantum superposition
    • State vector evolution
    • Quantum entanglement
    • Decoherence simulation
  • High entropy output (63.999872 bits/sample)
  • Comprehensive test suite with statistical validation
  • Extensive documentation and examples
  • Cross-platform C implementation
  • Hardware-optimized performance

⚡ Performance

  • 4.82M operations per second
  • 178.45 MB/sec throughput
  • ~4KB context size
  • Optimized for L1 cache usage
  • Verified non-deterministic output
  • Competitive with leading classical RNGs while providing quantum properties

🛠️ Installation

# Clone the repository
git clone https://github.com/tsotchke/quantum_rng.git
cd quantum_rng

# Build the library and examples
make

🚀 Quick Start

#include <quantum_rng.h>

int main() {
    qrng_ctx *ctx;
    qrng_error err;
    
    // Initialize RNG
    err = qrng_init(&ctx, NULL, 0);
    if (err != QRNG_SUCCESS) {
        fprintf(stderr, "Failed to initialize: %s\n", qrng_error_string(err));
        return 1;
    }
    
    // Generate random numbers
    printf("Random uint64: %lu\n", qrng_uint64(ctx));
    printf("Random double: %f\n", qrng_double(ctx));
    printf("Random range [1,6]: %d\n", qrng_range(ctx, 1, 6));
    
    // Cleanup
    qrng_free(ctx);
    return 0;
}

📚 Documentation

💡 Examples

🔒 Cryptography

The initial release includes two cryptographic examples that demonstrate the library's capabilities in security applications:

Key Derivation

Features:

  • Quantum-enhanced key derivation
  • Multiple iterations showing optimization progress
  • Comprehensive test suite
  • Performance analysis

Key Exchange

Features:

  • Secure key exchange protocol
  • Quantum entropy integration
  • Test suite with security verification
  • Performance benchmarks

💹 Finance

Monte Carlo Simulation

Features:

  • Advanced financial modeling using quantum randomness
  • Efficient path generation
  • Statistical analysis tools
  • Performance optimizations
  • Comprehensive documentation

🎲 Games

Quantum Dice

A simple but effective demonstration of the RNG in action:

  • Fair dice rolling implementation
  • Configurable sides (d4, d6, d8, d10, d12, d20, etc.)
  • Statistical distribution tests
  • Example of basic RNG usage

🧪 Testing

The library includes a comprehensive test suite:

# Run all tests
make test

# Run specific test suites
./tests/comprehensive_test  # Full functionality verification
./tests/edge_cases_test    # Edge case handling
./tests/test_quantum_rng   # Core RNG validation

Statistical Testing

# Run statistical tests
./tests/statistical/statistical_tests

# Run quantum property verification
./tests/quantum_stats

📊 Performance Testing

# Run full benchmark suite
make benchmark
./benchmark_suite

# Run specific benchmarks
./tests/benchmark_matrix   # Matrix operation performance

🔮 Future Improvements

We have several exciting examples and applications in development that will be released soon:

Finance Applications

  • Options Pricing - Black-Scholes model with quantum entropy
  • Quantum Portfolio - Portfolio optimization using quantum principles
  • Heston Model - Stochastic volatility modeling

Game Development

  • Quantum Evolution - Evolutionary algorithms with quantum randomness
  • Particle System - Physics-based particle simulation
  • Procedural Worlds - Terrain and world generation
  • Quantum Slots - Fair slot machine implementation
  • Terrain Generation - Advanced landscape generation
  • Loot System - Fair item drop system

Machine Learning

  • Quantum Transformer - RNG-enhanced transformer architecture
  • Neural Initialization - Quantum-inspired weight initialization
  • Quantum GAN - Generative adversarial network with quantum noise

Scientific Applications

  • Molecular Dynamics - Particle simulation
  • Quantum Walk - Random walk implementations
  • Weather Simulation - Atmospheric modeling
  • Quantum Noise - Advanced noise generation

Networking

  • Quantum Routing - Network routing algorithms
  • Traffic Simulation - Network traffic modeling

Each of these examples will be thoroughly tested and documented before release, demonstrating the versatility of the Quantum RNG library across different domains.

🤝 Contributing

We welcome contributions! Please see our Contributing Guidelines for details on:

  • Code style and standards
  • Testing requirements
  • Documentation expectations
  • Pull request process

📜 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • Nielsen & Chuang's "Quantum Computation and Quantum Information"
  • The quantum computing research community
  • All contributors and testers

📝 Citation

If you use this library in your research, please cite:

@software{quantum_rng,
  title = {Semi-Classical Quantum Random Number Generator With Examples},
  author = {tsotchke},
  year = {2024},
  url = {https://github.com/tsotchke/quantum_rng}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

semi_classicalqrng_py_bindings-1.1.0.tar.gz (16.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file semi_classicalqrng_py_bindings-1.1.0.tar.gz.

File metadata

File hashes

Hashes for semi_classicalqrng_py_bindings-1.1.0.tar.gz
Algorithm Hash digest
SHA256 f26cdf263ae74c68ff8c335013f188f7f373fe82f72dcbdaec054f2d8c783ad4
MD5 df47f2f22fd8a775babe2de328aa7775
BLAKE2b-256 0ef47e9f32cbcca9c5ec3dd2902c4ad46955aff0e49a32f74b7fbf48b6f8a769

See more details on using hashes here.

File details

Details for the file semi_classicalqrng_py_bindings-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for semi_classicalqrng_py_bindings-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8744f534dcd4d2a920aada06f422c8ad896d600de8fa302949128e21b582d3e8
MD5 2b8f43ca3f84732366648738d2f4ebda
BLAKE2b-256 8a48d0c4abb4027bb4749837ee8771ad2ec8fc2a965aaef80657b1d06c001756

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page