Giter Site home page Giter Site logo

randomly's Introduction

npm Build Status Build status Code Climate Test Coverage Coverage Status

Randomly

Randomly generate and sort data.

Installation

Run npm install --save randomly to add randomly to your project.

API Reference

randomly.string(length) ⇒ string

Creates a random string.

Kind: static method of randomly
Returns: string - The random string.
Throws:

  • TypeError Argument length must be a number
  • RangeError Argument length must be greater than or equal to 0
Param Type Description
length number The desired string length.

randomly.int(min, max) ⇒ number

Creates a random number within a range.

Kind: static method of randomly
Returns: number - The random number.
Throws:

  • TypeError Argument min must be a number
  • TypeError Argument max must be a number
Param Type Description
min number The lower bound.
max number The upper bound.

randomly.getLowerInt(degree) ⇒ number

Calculates the smallest n-digit number.

Kind: static method of randomly
Returns: number - The smallest n-digit number.
Throws:

  • TypeError Argument degree must be a number
  • RangeError Argument degree must be greater than or equal to 0
Param Type Description
degree number The number of digits.

randomly.getUpperInt(degree) ⇒ number

Calculates the largest n-digit number.

Kind: static method of randomly
Returns: number - The largest n-digit number.
Throws:

  • TypeError Argument degree must be a number
  • RangeError Argument degree must be greater than or equal to 0
Param Type Description
degree number The number of digits.

randomly.create(type, length) ⇒ string | number | Object

Creates a random string, number or object.

Kind: static method of randomly
Returns: string | number | Object - The random string, number or object.
Throws:

  • TypeError Argument length must be a number
  • RangeError Argument length must be greater than or equal to 0
Param Type Description
type function The type to create (e.g. String, Number or Object).
length number The length (for strings and Objects) or boundary degree (for numbers).

randomly.collect(type, quantity, length) ⇒ Array.<string> | Array.<number> | Array.<Object>

Creates an array of random strings, numbers or objects.

Kind: static method of randomly
Returns: Array.<string> | Array.<number> | Array.<Object> - The array of random strings, numbers or objects.
Throws:

  • TypeError Argument quantity must be a number
  • RangeError Argument quantity must be greater than 0
  • TypeError Argument length must be a number
  • RangeError Argument length must be greater than or equal to 0
Param Type Description
type function The type to create (e.g. String, Number or Object).
quantity number The quantity to create.
length number The length (for strings and Objects) or boundary degree (for numbers).

randomly.sort(array) ⇒ Array

Sorts an array in random order.

Kind: static method of randomly
Returns: Array - The sorted array.

Param Type Description
array Array The array to sort.

Testing

randomly includes several unit tests. After cloning the randomly repo locally, run npm install in the project folder to install dependencies. Run npm run build to update the built library, then npm test to execute the tests.

randomly's People

Contributors

smockle avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.