Posted By

ishikawa on 07/09/06


Tagged

ruby text


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

webstic


Random ASCII characters generator


 / Published in: Ruby
 

This method generates random (and printable) ascii characters.

  1. require 'enumerator'
  2.  
  3. def random_string(length=10, s="")
  4. length.enum_for(:times).inject(s) do |result, index|
  5. s << rand(93) + 33
  6. end
  7. end

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: on September 3, 2018

the 8 best budget laptops under 300 the8best

You need to login to post a comment.