Giter Site home page Giter Site logo

0xdir / rng_dart Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 4 KB

A library to generate very large random numbers (BigInt). Includes various generation techniques and sources of randomness for easy customization.

License: MIT License

Dart 100.00%
crypto dart random-number-generators web3

rng_dart's Introduction

pub package package publisher

A library to generate very large random numbers (BigInt). Includes various generation techniques and sources of randomness for easy customization.

This package is designed to have as few dependencies as possible.

Using

The easiest way to use this library is via the top-level Rng class.

import 'package:rng/rng.dart';

void main() {
  /// Initialize the main object
  Rng rng = Rng();

  /// Get a random BigInt using a particular technique eg. byte-filled
  /// for a specified bit length of 256
  /// 
  /// This technique fills a list of bytes with random values from 0 to 255
  /// until the specified bit length is reached.
  ///
  /// This technique accepts bit lengths in multiples of 8.
  /// eg. 8, 16, 32, 64, 128, 256, 512, ...
  ///
  /// And quantizes to nearest multiple of 8-bits if alternative bit lengths are provided.
  BigInt randomNumber1 = rng.getByteFilledBigInt(bitLength: 256);

  /// Do stuff with the number
  print(randomNumber1);
}

Scope of implementation

More techniques to generate very large random numbers (BigInts) and sources of randomness will be added over time.

All requests are welcome, feel free to open a discussion on github.

Use cases

This library is designed for users who need very large random numbers (BigInts) above 64-bits in length.

If you are working with random numbers smaller than 64-bits in length, ie. values less than 2^64-1 the dart:math library will suit your needs perfectly.

If you are using this library for cryptography, encryption, or blockchain related applications, feel free to reach out if you need assistance on any audits.

Getting Help

Submit an issue on github.

How to contribute

All feedback and suggestions for improvements are welcome:

  1. Open a discussion on github
  2. Discuss proposed changes
  3. Submit a PR (optional)

Support my work

This package is possible thanks to the people and companies who donate money, services or time to keep the project running.

If you're interested in becoming a Sponsor, Backer or Contributor to expand the project, reach out to me on github.

Or buy me coffee at 0xdir.near.

rng_dart's People

Contributors

0xdir avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.