Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/iddm/randomorg
A random.org client library for Rust
https://github.com/iddm/randomorg
library random rust
Last synced: 23 days ago
JSON representation
A random.org client library for Rust
- Host: GitHub
- URL: https://github.com/iddm/randomorg
- Owner: iddm
- License: mit
- Created: 2017-06-27T10:51:44.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-12-05T17:49:26.000Z (about 1 year ago)
- Last Synced: 2024-11-09T06:38:52.584Z (about 1 month ago)
- Topics: library, random, rust
- Language: Rust
- Size: 46.9 KB
- Stars: 8
- Watchers: 1
- Forks: 4
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-rust - iddm/randomorg - A random.org client library. [![Crates badge](https://img.shields.io/crates/v/randomorg.svg)](https://crates.io/crates/randomorg) (Libraries / Cryptography)
- awesome-rust - iddm/randomorg - A random.org client library. [![Crates badge](https://img.shields.io/crates/v/randomorg.svg)](https://crates.io/crates/randomorg) (Libraries / Cryptography)
- fucking-awesome-rust - iddm/randomorg - A random.org client library. [![Crates badge](https://img.shields.io/crates/v/randomorg.svg)](https://crates.io/crates/randomorg) (Libraries / Cryptography)
- fucking-awesome-rust - iddm/randomorg - A random.org client library. [![Crates badge](https://img.shields.io/crates/v/randomorg.svg)](https://crates.io/crates/randomorg) (Libraries / Cryptography)
README
# random.org
[![Build status](https://travis-ci.org/iddm/randomorg.svg?branch=master)](https://travis-ci.org/iddm/randomorg)
[![Crates](https://img.shields.io/crates/v/randomorg.svg)](https://crates.io/crates/randomorg)
[![Docs](https://docs.rs/randomorg/badge.svg)](https://docs.rs/randomorg)
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)A https://random.org client library. The randomness comes from atmospheric noise, which
for many purposes is better than the pseudo-random number algorithms typically used in computer
programs.## Status
Everything is implemented. Note, that the [`random.org`](https://random.org) service
API is at beta stage of development, however the library will try to be up-to-date.## The documentation
The [documentation](https://docs.rs/randomorg) which may help you using this library.## Implementation
- Immutable interface, no need to synchronize,
thread-safe ([`Sync`](https://doc.rust-lang.org/std/marker/trait.Sync.html) and
[`Send`](https://doc.rust-lang.org/std/marker/trait.Send.html)).
- No unsafe blocks.
- [`reqwest`](https://crates.io/crates/reqwest) crate is used for performing requests.
- [`chrono`](https://crates.io/crates/chrono) for dates.
- [`serde`](https://crates.io/crates/serde) for serialization and deserialization.## Features
- `rand` feature which provides the
[`rand_core::RngCore`](https://rust-random.github.io/rand/rand_core/trait.RngCore.html)
trait implementation for the [`Random`](https://docs.rs/randomorg/0.5.0/randomorg/struct.Random.html)
struct and adds new `FallibleRandom` structure
for better random generation UX.## Usage
Start by creating `Random` instance and perform needed operations after.```rust
extern crate randomorg;fn main() {
use randomorg::Random;
let r = Random::new("API KEY HERE");
// A method-call way:
println!("Result: {:?}", r.generate_integers(-100, 100, 15, true));
// A lazy request builder way:
let random_data = r.request_integers().min(0).max(100).limit(5).collect::>();
println!("Random integers: {:?}", random_data);
}
```With the `rand` feature you can also use it that way:
```rust
extern crate randomorg;fn main() {
use rand_core::RngCore;
use randomorg::Random;
let mut random = Random::new("API KEY HERE");
let mut key = [0u8; 16];
random.fill_bytes(&mut key);
let random_u64 = random.next_u64();
}
```## License
This project is
[licensed under the MIT license](https://github.com/iddm/randomorg/blob/master/LICENSE).