How To Install golang-github-nebulouslabs-fastrand-dev on Ubuntu 18.04

In this tutorial we learn how to install golang-github-nebulouslabs-fastrand-dev on Ubuntu 18.04. golang-github-nebulouslabs-fastrand-dev is 10x faster than crypto/rand

Introduction

In this tutorial we learn how to install golang-github-nebulouslabs-fastrand-dev on Ubuntu 18.04.

What is golang-github-nebulouslabs-fastrand-dev

golang-github-nebulouslabs-fastrand-dev is:

fastrand GoDoc (https://godoc.org/github.com/NebulousLabs/fastrand) Go Report Card (https://goreportcard.com/report/github.com/NebulousLabs/fastrand)

go get github.com/NebulousLabs/fastrand

fastrand implements a cryptographically secure pseudorandom number generator. The generator is seeded using the system’s default entropy source, and thereafter produces random values via repeated hashing. As a result, fastrand can generate randomness much faster than crypto/rand, and generation cannot fail beyond a potential panic during init().

Unlike both crypto/rand and math/rand, fastrand provides significant speedups when called using parallelism. In fact, fastrand can even outperform math/rand when using enough threads.

Packages uses something similar to the Fortuna algorithm, which is used in FreeBSD as its /dev/random. The techniques used by fastrand are known to be secure, however the specific implementation has not been reviewed extensively. Use with caution.

The general strategy is to use crypto/rand at init to get 32 bytes of strong entropy. From there, the entropy concatenated to a counter and hashed repeatedly, providing a new 64 bytes of random output each time the counter is incremented. The counter is 16 bytes, which provides strong guarantees that a cycle will not be seen throughout the lifetime of the program.

The sync/atomic package is used to ensure that multiple threads calling fastrand concurrently are always guaranteed to end up with unique counters, allowing callers to see speedups by calling concurrently, without compromising security.

There are three methods to install golang-github-nebulouslabs-fastrand-dev on Ubuntu 18.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install golang-github-nebulouslabs-fastrand-dev Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install golang-github-nebulouslabs-fastrand-dev using apt-get by running the following command:

sudo apt-get -y install golang-github-nebulouslabs-fastrand-dev

Install golang-github-nebulouslabs-fastrand-dev Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install golang-github-nebulouslabs-fastrand-dev using apt by running the following command:

sudo apt -y install golang-github-nebulouslabs-fastrand-dev

Install golang-github-nebulouslabs-fastrand-dev Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install golang-github-nebulouslabs-fastrand-dev using aptitude by running the following command:

sudo aptitude -y install golang-github-nebulouslabs-fastrand-dev

How To Uninstall golang-github-nebulouslabs-fastrand-dev on Ubuntu 18.04

To uninstall only the golang-github-nebulouslabs-fastrand-dev package we can use the following command:

sudo apt-get remove golang-github-nebulouslabs-fastrand-dev

Uninstall golang-github-nebulouslabs-fastrand-dev And Its Dependencies

To uninstall golang-github-nebulouslabs-fastrand-dev and its dependencies that are no longer needed by Ubuntu 18.04, we can use the command below:

sudo apt-get -y autoremove golang-github-nebulouslabs-fastrand-dev

Remove golang-github-nebulouslabs-fastrand-dev Configurations and Data

To remove golang-github-nebulouslabs-fastrand-dev configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge golang-github-nebulouslabs-fastrand-dev

Remove golang-github-nebulouslabs-fastrand-dev configuration, data, and all of its dependencies

We can use the following command to remove golang-github-nebulouslabs-fastrand-dev configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge golang-github-nebulouslabs-fastrand-dev

References

Summary

In this tutorial we learn how to install golang-github-nebulouslabs-fastrand-dev package on Ubuntu 18.04 using different package management tools: apt, apt-get and aptitude.