can we generate auto generate alphanumeric characters for password ?

Certified Associate Developer

like we get alphanumeric characters we get to reset the password ?

  Discussion posts and replies are publicly visible

Parents
  • +1
    Certified Associate Developer

    a!localVariables(
      local!array: {
        33 + tointeger(rand(5) * (47 - 33)), /* For special chars*/
        48 + tointeger(rand(8) * (57 - 48)), /* For integer*/
        65 + tointeger(rand(10) * (90 - 65)) /* For alphabets*/
      },
      local!oldIndex: enumerate(length(local!array)) + 1,
      local!newIndex: union(
        1 + tointeger(
          rand(length(local!array)) * (length(local!array) - 1)
        ),
        tointeger({})
      ),
      local!diffindex: difference(local!oldIndex, local!newIndex),
      local!finalIndex: append(local!newIndex, local!diffindex),
      joinarray(
        a!forEach(
          items: local!finalIndex,
          expression: char(index(local!array, fv!item, {}))
        ),
        ""
      )
    )

    Here, 5, 8, and 10 represent the length of the characters written next to them!

Reply
  • +1
    Certified Associate Developer

    a!localVariables(
      local!array: {
        33 + tointeger(rand(5) * (47 - 33)), /* For special chars*/
        48 + tointeger(rand(8) * (57 - 48)), /* For integer*/
        65 + tointeger(rand(10) * (90 - 65)) /* For alphabets*/
      },
      local!oldIndex: enumerate(length(local!array)) + 1,
      local!newIndex: union(
        1 + tointeger(
          rand(length(local!array)) * (length(local!array) - 1)
        ),
        tointeger({})
      ),
      local!diffindex: difference(local!oldIndex, local!newIndex),
      local!finalIndex: append(local!newIndex, local!diffindex),
      joinarray(
        a!forEach(
          items: local!finalIndex,
          expression: char(index(local!array, fv!item, {}))
        ),
        ""
      )
    )

    Here, 5, 8, and 10 represent the length of the characters written next to them!

Children