1.0.1 • Published 4 years ago

myrandom v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

myrandom

simple module to generate randint, randstr and random choice of a list

Example

npm install --save myrandom

  • First file index.js :
import MyRandom from 'myrandom'
const Store = MyRandom()

console.log(Store.randstr(20)) // 20 length of str
console.log(Store.randint(5)) // 5 length of int

const list = ['a', 'b', 'c', 'd']
console.log(Store.choice(list)) // choose randomly from Array

export {
  Store // exporting so to ensure not repeating any previously used random
}
  • Second file second.js :
import { Store } from './index.js'

console.log(Store.randstr(20))