Alga.js
  • Introduction
  • Installation
  • Array
    • $.array.insert
    • $.array.update
    • $.array.destroy
    • $.array.select
    • $.array.hidden
    • $.array.search
    • $.array.filter
    • $.array.paginate
    • $.array.sort
    • $.array.setOperations
    • $.array.sum
    • $.array.calculate
  • Object
    • $.object.remove
  • String & Char
    • $string.split
    • $.char.random
  • Number (Int & Float)
    • $.number.calc
    • $.number.currency
  • Date
    • $.date.now
    • $.date.format
    • $.date.parse
    • $.date.days
    • $.date.weeks
    • $.date.months
    • $date.calendar
Powered by GitBook
On this page

Was this helpful?

  1. String & Char

$.char.random

Random method of char helpers

Previous$string.splitNext$.number.calc

Last updated 3 years ago

Was this helpful?

This random helper can be use for generating random password, unique ID, custom color, and so on. Random method only have 2 arguments, the length of character and the type of character (only accept long, short, narrow, hex and number type).

$.char.random(lengthOfCharacter, typeOfCharacter)

// Example:
$.char.random() // length is 11 and 'long' as default type
//=> Oht,^o%JfeV

$.char.random(6, 'hex') // add '#' manually by yourself
//=> afe865

$.char.random(3, 'number')
//=> 430

$.char.random(11, 'short')
//=> 4eF5m_0C75L

$.char.random(8, 'narrow')
//=> zxtlxj7m

Also, we provide real world application example like this show/hide password generator that use Petite-Vue and this random method.

Visit this link:

https://codepen.io/tedirghazali
/pen/GRmyqKB