And C# replies

Brian read my previous post and quickly replied with this functionally identical C# code:
string schars = "0124356789abcdefghijk";
string password = string.Empty;
Random rand = new Random(DateTime.Now.Millisecond);
while (password.Length < 9) password += schars[rand.Next(0, schars.Length)];

The only real difference is the rand seeding. I still find the Ruby easier to understand thanks to the upto method and the fact that numbers are objects in Ruby. Thanks for the code though Brian.

Viewing 1 Comment

 

Trackbacks

(Trackback URL)

close Reblog this comment
blog comments powered by Disqus