Coder Social home page Coder Social logo

small-uid's People

Contributors

mediagone avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

fbeppu

small-uid's Issues

Why value length varies? Can I set a fixed length?

If I generate multiple ids, some have different lengths.

Can I set the length to a fixed number?

$list = [];
foreach (range(0, 10) as $i) {
  $uid = SmallUid::random();
  $val = (string)$uid;
  $hex = (string)$uid->toHex();
  $list[] = ['val' => $val, 'hex' => $hex, 'len' => strlen($val)];
}

In this case, the length of the first value is 10, while the others is 11:

[
  [
    "val" => "QvgsOfS1x3",
    "hex" => "185cb8707fd2f050",
    "len" => 10,
  ],
  [
    "val" => "19YmwgRJ5jl",
    "hex" => "185cb8707fd917d0",
    "len" => 11,
  ],
  [
    "val" => "KmgTohaPbzF",
    "hex" => "185cb8707fd3912f",
    "len" => 11,
  ],
  [
    "val" => "1aosJi8Frgv",
    "hex" => "185cb8707fd90921",
    "len" => 11,
  ],
  [
    "val" => "LuPBmpmAZwP",
    "hex" => "185cb8707fd523ff",
    "len" => 11,
  ],
  [
    "val" => "BKi8xxXjevB",
    "hex" => "185cb8707fdc3048",
    "len" => 11,
  ],
  [
    "val" => "I4uVEA8Mn4r",
    "hex" => "185cb8707fd6492d",
    "len" => 11,
  ],
  [
    "val" => "BWFmtfbp2PJ",
    "hex" => "185cb8707fdee268",
    "len" => 11,
  ],
  [
    "val" => "FkU5aXrL0Ur",
    "hex" => "185cb8707fd7277b",
    "len" => 11,
  ],
  [
    "val" => "A1Xajyi4a6T",
    "hex" => "185cb8707fd04c47",
    "len" => 11,
  ],
  [
    "val" => "6JSFSjzUfs9",
    "hex" => "185cb8707fd6a894",
    "len" => 11,
  ],
]

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.