How to resolve the algorithm Random numbers step by step in the J programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Random numbers step by step in the J programming language
Table of Contents
Problem Statement
Generate a collection filled with 1000 normally distributed random (or pseudo-random) numbers with a mean of 1.0 and a standard deviation of 0.5 Many libraries only generate uniformly distributed random numbers. If so, you may use one of these algorithms.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Random numbers step by step in the J programming language
Source code in the j programming language
urand=: ?@$ 0:
zrand=: (2 o. 2p1 * urand) * [: %: _2 * [: ^. urand
1 + 0.5 * zrand 100
require 'stats/distribs/normal'
1 0.5 rnorm 1000
1.44868803 1.21548637 0.812460657 1.54295452 1.2470606 ...
You may also check:How to resolve the algorithm Variable size/Get step by step in the UNIX Shell programming language
You may also check:How to resolve the algorithm Guess the number step by step in the Wortel programming language
You may also check:How to resolve the algorithm Write float arrays to a text file step by step in the Forth programming language
You may also check:How to resolve the algorithm URL decoding step by step in the REXX programming language
You may also check:How to resolve the algorithm Queue/Definition step by step in the ERRE programming language