Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

to_hex does not seem to be in the standard library, but these will work and are rather elegant to get a short random string. Thanks, Patrick!

  rand(16**16).to_s(16)
  rand(16**16).to_s(36)





Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: