Hi everyone, I thought this would be a fun brain teaser. In short, I need a way to generate a semi-random file name based on a template on MS Windows. The motivation, in case you're wondering, is that I'm implementing a pure Ruby version of the mkstemp() function, which MS Windows does not support. The rules: 1 - The template itself must be a legal MS Windows file name 2 - The template must end with at least six 'X' characters. Raise an error otherwise. 3 - All 'X' characters should be replaced with a (semi) random character 4 - All replaced characters must be legal filename characters on MS Windows For example, my_template_XXXXXX would become my_template_T$#z%Ya What's a legal filename on Windows? To keep it simple, we'll just worry about these three rules: * The following characters are illegal: < > : " / \ | ? * * Characters whose integer representations are in the range from zero through 31 are not allowed. * Cannot end with a space In case that first point is difficult to read on your browser, the explicitly illegal characters are greater than, less than, colon, forward slash, backslash, pipe, question mark and asterisk. Good luck! Dan - Details for legal file names at http://msdn.microsoft.com/en-us/library/aa365247(VS.85).aspx - Details for mkstemp at http://www.opengroup.org/onlinepubs/009695399/functions/mkstemp.html