You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

random.md 807B

12345678910111213141516171819202122232425262728293031
  1. # `String.random(options = { ... })` _(ext/string/random)_
  2. Returns generated random string, contained only of ascii cars `a-z` and `0-1`.
  3. By default returns string of length `10`.
  4. ```javascript
  5. const random = require("ext/string/random");
  6. random(); // "upcfns0i4t"
  7. random({ length: 3 }); // "5tw"
  8. ```
  9. ## Supported options:
  10. ### `isUnique: false`
  11. Ensures generated string is unique among ones already returned.
  12. _Note: When not applying this setting, accidental generation of same string is still highly unlikely. Provided option is just to provide a mean to eliminate possibility of an edge case of duplicate string being returned_
  13. ### `length: 10`
  14. Desired length of result string
  15. ### `charset: null`
  16. Fixed list of possible characters
  17. ```javascript
  18. random({ charset: "abc" }); // "bacbccbbac"
  19. ```