jump to navigation

Generate random number in RUBY January 22, 2008

Posted by amithasija in Ruby on Rails.
Tags: ,
trackback

size=8
s = “”
size.times { s << (i = Kernel.rand(62); i += ((i < 10) ? 48 : ((i < 36) ? 55 : 61 ))).chr }
s
@var= s

puts @var

Comments»

No comments yet — be the first.