# [Tutor] simple random string generator

Dave Angel d at davea.name
Tue Sep 18 00:19:50 CEST 2012

```On 09/17/2012 05:40 PM, Matthew Dalrymple wrote:
>
>
>>>
>>>
>>
>> Did you look for bugs before trying to time it?  For example, did you
>> intend that it test the sizes from 10 thru 195 in steps of 5, or did you
>> intend from 10 to 100, as you stated in your first post?
>>
>> Would you care to add a docstring to those functions to indicate what
>> they're intended to do?  i think maybe the anagramSolutionX functions
>> are supposed to return True if the two strings contain the same letters
>> (including the same number of duplicates) in an arbitrary order.
>>
>> Are you interested in faster algorithms for such a comparison?  I think
>> that function could be implemented in two lines of Python, using only
>> builtin functions.  And that includes the def line.
>>
>> Did you intend to put the timings for anagramSolution2 into solu1, and
>> the timings for anagramSolution1 into solu2, and thus print them out in
>> reverse order?  it makes it hard to see what difference incremental
>> changes might make.
>>
>>
>>
>> --
>>
>> DaveA
>> its for a class...we were given the anagramSolutionX functions...we have to comapre those using time.time() and get accurate reading by running each function at least 10000 times to each word from 10 to 100 in steps of 5. i went up to 200 just to see if one would increase faster as the number increased but it didn't...also i realized i had the solutions labled wrong so i was starting to switch them and didnt finish :S sorry... before i started trying to  time it, it ran creating words from 10-100 in steps of 5... make sense? the assignment we were given was to create a mkword(n) function and get it to generate the strings from 10-100 in steps of 5 and check to see which solution would be faster...
>
>

Do you realize the the difference between open-ended and closed?  When
you put the 200 there, the last one it'll do is 195.  Likewise, if you
said range(10, 100, 5), it would stop at 95.  That's why Steven had the
+1 in his first message.

--

DaveA
```

More information about the Tutor mailing list