How to resolve the algorithm Random number generator (included) step by step in the Elixir programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Random number generator (included) step by step in the Elixir programming language
Table of Contents
Problem Statement
The task is to: Note: the task is not to create an RNG, but to report on the languages in-built RNG that would be the most likely RNG used. The main types of pseudo-random number generator (PRNG) that are in use are the Linear Congruential Generator (LCG), and the Generalized Feedback Shift Register (GFSR), (of which the Mersenne twister generator is a subclass). The last main type is where the output of one of the previous ones (typically a Mersenne twister) is fed through a cryptographic hash function to maximize unpredictability of individual bits. Note that neither LCGs nor GFSRs should be used for the most demanding applications (cryptography) without additional steps.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Random number generator (included) step by step in the Elixir programming language
Source code in the elixir programming language
# Seed the RNG
:random.seed(:erlang.now())
# Integer in the range 1..10
:random.uniform(10)
# Float between 0.0 and 1.0
:random.uniform()
You may also check:How to resolve the algorithm 100 doors step by step in the Lily programming language
You may also check:How to resolve the algorithm Maze generation step by step in the Forth programming language
You may also check:How to resolve the algorithm Sorting algorithms/Heapsort step by step in the Draco programming language
You may also check:How to resolve the algorithm Averages/Mode step by step in the BBC BASIC programming language
You may also check:How to resolve the algorithm Function composition step by step in the REXX programming language