random-atomic-array
v1.0.4
Published
Create random values for an Array easily
Downloads
3
Readme
Random Array
randomArray(length, functionToCreateTheVaue)
For example lets create an Array with 10 elements filling with value 0:
randomAtomicArray(10, () => 0)
// [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
And how it´s a create function expected we can easily create random numbers using external modules like: random-numbers, random-even-numbers, random-odd-numbers, etc.
'use strict'
const create = {}
create._Array = require('random-atomic-array')
create._Number = require('random-numbers')
const arr = create._Array.randomArray(10, create._Number.randomNumber)
console.log('arr', arr)
// [ 88, 23, 55, 13, 4, 99, 16, 72, 81, 2 ]