hwrandom


Namehwrandom JSON
Version 0.0.5 PyPI version JSON
download
home_pagehttps://github.com/RaymonDev/hwrandom
SummaryThe hwrandom Python package uses Intel’s RDRAND instruction to generate high-entropy, cryptographically secure random numbers for various applications.
upload_time2024-08-19 13:54:58
maintainerNone
docs_urlNone
authorRaymonDev
requires_pythonNone
licenseNone
keywords random hardware random rdrand cryptographic randomness random number generator secure random python
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # hwrandom

**hwrandom** is a Python package that provides a high-performance random number generator using Intel's RDRAND instruction. By leveraging hardware-based randomness, **hwrandom** delivers cryptographically secure random numbers with superior entropy compared to traditional software-based methods.

Its aim is to have all the same functionalities as the standard ```random``` package.

## Index
- [Features](#features)
- [Usage](#usage)
  - [Instalation](#instalation)
  - [Examples](#examples)
- [Functions](#functions)
- [Tested](#tested)
- [To Add](#to-add)

## Features

- **Hardware-Based Randomness**: Utilizes Intel's RDRAND instruction for generating true hardware-based random numbers.
- **Cryptographic Security**: Provides cryptographically secure random numbers suitable for secure applications.
- **Versatile Functionality**: Includes functions for generating random integers, floating-point numbers, and selections from sequences.

## Usage

### Instalation

To install **hwrandom**, you can use pip. Simply run:

```
pip install hwrandom
```

### Examples

Here are some examples of how to use the **hwrandom** package:

#### Generating a Random Number
```py
from hwrandom import random

# Generate a random number between 0 and 1
print(random())
```

#### Generating a Random Integer
```py
from hwrandom import randint 

# Generate a random integer between 1 and 10 
print(randint(1, 10))
```
#### Choosing from a list
```py
from hwrandom import choice

# Choose a random element from a list
print(choice(['apple', 'banana', 'cherry', 'date']))
```
#### Shuffling a list
```py
from hwrandom import shuffle

lst = [1, 2, 3, 4, 5]
shuffle(lst)
print(lst)
```
#### Generating Random Bits
```py
from rdrandom import getrandbits

# Generate a random number with 8 bits
print(getrandbits(8))
```


## Functions
-   **`random()`**: Generates a random floating-point number between 0 and 1.
-   **`randint(a, b)`**: Returns a random integer N such that `a <= N <= b`.
-   **`randrange(start, stop, step)`**: Returns a randomly selected element from the range `start` to `stop` with the specified `step`.
-   **`choice(seq)`**: Returns a random element from a non-empty sequence.
-   **`shuffle(seq)`**: Shuffles the sequence in place.
-   **`getrandbits(k)`**: Returns a Python integer with `k` random bits.
-   **`choices(population, weights=None, cum_weights=None, k=1, repetitions=True)`**: Returns a list of `k` elements chosen from the population with optional weights.
-   **`sample(population, k=1)`**: Returns a list of `k` unique elements chosen from the population.
-   **`uniform(a, b)`**: Returns a random floating-point number between `a` and `b`.
-   **`triangular(low, high, mode)`**: Returns a random number between `low` and `high` with the specified `mode`.


## Tested

**hwrandom** was tested in the following:

- [x] Windows 64 bits (Intel)
- [ ] Windows 32 bits (Intel)
- [ ] Windows 64 bits (AMD)
- [ ] Windows 32 bits (AMD)
- [ ] Linux 64 bits (Intel)
- [ ] Linux 32 bits (Intel)
- [ ] Linux 64 bits (AMD)
- [ ] Linux 32 bits (AMD)

## To Add

- [ ] **betavariate(alpha, beta)**: Beta distribution.
- [ ] **expovariate(lambd)**: Exponential distribution.
- [ ] **gammavariate(alpha, beta)**: Gamma distribution.
- [ ] **gauss(mu, sigma)**: Gaussian distribution.
- [ ] **lognormvariate(mu, sigma)**: Log-normal distribution.
- [ ] **normalvariate(mu, sigma)**: Normal distribution.
- [ ] **vonmisesvariate(mu, kappa)**: Von Mises distribution.
- [ ] **paretovariate(alpha)**: Pareto distribution.
- [ ] **weibullvariate(alpha, beta)**: Weibull distribution.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/RaymonDev/hwrandom",
    "name": "hwrandom",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "random, hardware random, RDRAND, cryptographic randomness, random number generator, secure random, python",
    "author": "RaymonDev",
    "author_email": "ramongallinadcorti@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/e4/d0/4626efffaa0ef0b1345405de0b949d7a3055d507d906c508cbad43805268/hwrandom-0.0.5.tar.gz",
    "platform": null,
    "description": "# hwrandom\r\n\r\n**hwrandom** is a Python package that provides a high-performance random number generator using Intel's RDRAND instruction. By leveraging hardware-based randomness, **hwrandom** delivers cryptographically secure random numbers with superior entropy compared to traditional software-based methods.\r\n\r\nIts aim is to have all the same functionalities as the standard ```random``` package.\r\n\r\n## Index\r\n- [Features](#features)\r\n- [Usage](#usage)\r\n  - [Instalation](#instalation)\r\n  - [Examples](#examples)\r\n- [Functions](#functions)\r\n- [Tested](#tested)\r\n- [To Add](#to-add)\r\n\r\n## Features\r\n\r\n- **Hardware-Based Randomness**: Utilizes Intel's RDRAND instruction for generating true hardware-based random numbers.\r\n- **Cryptographic Security**: Provides cryptographically secure random numbers suitable for secure applications.\r\n- **Versatile Functionality**: Includes functions for generating random integers, floating-point numbers, and selections from sequences.\r\n\r\n## Usage\r\n\r\n### Instalation\r\n\r\nTo install **hwrandom**, you can use pip. Simply run:\r\n\r\n```\r\npip install hwrandom\r\n```\r\n\r\n### Examples\r\n\r\nHere are some examples of how to use the **hwrandom** package:\r\n\r\n#### Generating a Random Number\r\n```py\r\nfrom hwrandom import random\r\n\r\n# Generate a random number between 0 and 1\r\nprint(random())\r\n```\r\n\r\n#### Generating a Random Integer\r\n```py\r\nfrom hwrandom import randint \r\n\r\n# Generate a random integer between 1 and 10 \r\nprint(randint(1, 10))\r\n```\r\n#### Choosing from a list\r\n```py\r\nfrom hwrandom import choice\r\n\r\n# Choose a random element from a list\r\nprint(choice(['apple', 'banana', 'cherry', 'date']))\r\n```\r\n#### Shuffling a list\r\n```py\r\nfrom hwrandom import shuffle\r\n\r\nlst = [1, 2, 3, 4, 5]\r\nshuffle(lst)\r\nprint(lst)\r\n```\r\n#### Generating Random Bits\r\n```py\r\nfrom rdrandom import getrandbits\r\n\r\n# Generate a random number with 8 bits\r\nprint(getrandbits(8))\r\n```\r\n\r\n\r\n## Functions\r\n-   **`random()`**: Generates a random floating-point number between 0 and 1.\r\n-   **`randint(a, b)`**: Returns a random integer N such that `a <= N <= b`.\r\n-   **`randrange(start, stop, step)`**: Returns a randomly selected element from the range `start` to `stop` with the specified `step`.\r\n-   **`choice(seq)`**: Returns a random element from a non-empty sequence.\r\n-   **`shuffle(seq)`**: Shuffles the sequence in place.\r\n-   **`getrandbits(k)`**: Returns a Python integer with `k` random bits.\r\n-   **`choices(population, weights=None, cum_weights=None, k=1, repetitions=True)`**: Returns a list of `k` elements chosen from the population with optional weights.\r\n-   **`sample(population, k=1)`**: Returns a list of `k` unique elements chosen from the population.\r\n-   **`uniform(a, b)`**: Returns a random floating-point number between `a` and `b`.\r\n-   **`triangular(low, high, mode)`**: Returns a random number between `low` and `high` with the specified `mode`.\r\n\r\n\r\n## Tested\r\n\r\n**hwrandom** was tested in the following:\r\n\r\n- [x] Windows 64 bits (Intel)\r\n- [ ] Windows 32 bits (Intel)\r\n- [ ] Windows 64 bits (AMD)\r\n- [ ] Windows 32 bits (AMD)\r\n- [ ] Linux 64 bits (Intel)\r\n- [ ] Linux 32 bits (Intel)\r\n- [ ] Linux 64 bits (AMD)\r\n- [ ] Linux 32 bits (AMD)\r\n\r\n## To Add\r\n\r\n- [ ] **betavariate(alpha, beta)**: Beta distribution.\r\n- [ ] **expovariate(lambd)**: Exponential distribution.\r\n- [ ] **gammavariate(alpha, beta)**: Gamma distribution.\r\n- [ ] **gauss(mu, sigma)**: Gaussian distribution.\r\n- [ ] **lognormvariate(mu, sigma)**: Log-normal distribution.\r\n- [ ] **normalvariate(mu, sigma)**: Normal distribution.\r\n- [ ] **vonmisesvariate(mu, kappa)**: Von Mises distribution.\r\n- [ ] **paretovariate(alpha)**: Pareto distribution.\r\n- [ ] **weibullvariate(alpha, beta)**: Weibull distribution.\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "The hwrandom Python package uses Intel\u2019s RDRAND instruction to generate high-entropy, cryptographically secure random numbers for various applications.",
    "version": "0.0.5",
    "project_urls": {
        "Homepage": "https://github.com/RaymonDev/hwrandom"
    },
    "split_keywords": [
        "random",
        " hardware random",
        " rdrand",
        " cryptographic randomness",
        " random number generator",
        " secure random",
        " python"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d3d87a5efa38b136de047fdfa7415a657751e91a1e53f0a51dcbdb62a5ec37a7",
                "md5": "42e5bb4b1e8a8cacef09eb2337590b4d",
                "sha256": "d3a71c07a77da1c30c24e8af719805fe61b446b2e2cd2a327dcd6115dec8642f"
            },
            "downloads": -1,
            "filename": "hwrandom-0.0.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "42e5bb4b1e8a8cacef09eb2337590b4d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 98211,
            "upload_time": "2024-08-19T13:54:57",
            "upload_time_iso_8601": "2024-08-19T13:54:57.063963Z",
            "url": "https://files.pythonhosted.org/packages/d3/d8/7a5efa38b136de047fdfa7415a657751e91a1e53f0a51dcbdb62a5ec37a7/hwrandom-0.0.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e4d04626efffaa0ef0b1345405de0b949d7a3055d507d906c508cbad43805268",
                "md5": "9800fd4461a808ee0293f1b90266fae4",
                "sha256": "618b0c90d2468fe85b64a76aa9ce662589286541e0049bff7bb1f656953a0144"
            },
            "downloads": -1,
            "filename": "hwrandom-0.0.5.tar.gz",
            "has_sig": false,
            "md5_digest": "9800fd4461a808ee0293f1b90266fae4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 97856,
            "upload_time": "2024-08-19T13:54:58",
            "upload_time_iso_8601": "2024-08-19T13:54:58.662233Z",
            "url": "https://files.pythonhosted.org/packages/e4/d0/4626efffaa0ef0b1345405de0b949d7a3055d507d906c508cbad43805268/hwrandom-0.0.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-19 13:54:58",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "RaymonDev",
    "github_project": "hwrandom",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "hwrandom"
}
        
Elapsed time: 0.32118s