On Sep 17, 1:30=A0pm, Lloyd Linklater <ll... / 2live4.com> wrote:
> Actually, this might be a bit cleaner:
>
> def randomFileNameSuffix (numberOfRandomchars)
> =A0 s =3D ""
> =A0 numberOfRandomchars.times { s << (65 + rand(26)) =A0}
> =A0 s
> end
>
> puts "foo_" + randomFileNameSuffix(7) + ".txt"
>
> =3D> foo_OLNMGZZ.txt
>
> Note: =A0the 65 added is the numeric value of "A". =A0rand(26) gives 0..2=
5.
> So, we add that to a capital "A" to get the random letter.
>
> It is rather simple but that is not always a defect.

Simple, effective. Looks good to me!

Regards,

Dan