Skip to content
This repository has been archived by the owner on Apr 7, 2019. It is now read-only.
/ random.js Public archive

javascript random numbers and string generation library

Notifications You must be signed in to change notification settings

abidon/random.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

random.js

javascript random numbers and string generation library

Documentation coverage — provided by inch-ci.org

usage:

use it from your html page:

	<script type="text/javascript" src="random.js"></script>

or from a node.js project

	// in your package.json
	dependencies: [
		"random.js": "0.1.0"
	]
	// in your js file
	var random = require('random')

functions:

  • randomInt([options]): generate random integers

    • parameters:
      • options:Object
        • min:Int:
          the minimum value (default: 0)
        • max:Int:
          the maximum value (default: 4294967295)
    • returns: an integer between the min/max bounds
  • randomFloat([options]): generate random floats

    • parameters:
      • options:Object:
        • min:Float:
          the minimum value (default: 0.0)
        • max:Float:
          the maximum value (default: 1.0)
    • returns an integer between the min/max bounds
  • randomString([options]): generate random strings

    • parameters:
      • options:Object
        • length:Int:
          the length of the string to generate (default: 20)
        • set:String:
          one of "alpha" | "numeric" | "alphanum" | "hex" | "custom" (default: "alphanum")
        • custom:String/Array<char>:
          if set is "custom", provides a set of characters used for the string generation
        • returns a string containing random characters from the selected set of the given length
        • note: when generating hexadecimal strings, the alpha-characters are uppercase, use .toLowerCase() on the result to switch to lowercase

About

javascript random numbers and string generation library

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published