I am writing a function to help out our test department put random phone numbers into a phone number field. 

Here is my code:

```
from random import randrange

def phonenumbergenerator():
    phonenumber = randrange(1111111111, 9999999999)
    phonenumberformatted = (str("%s-%s-%s" % (phonenumber[:3], phonenumber[3:6], phonenumber[6:])))
    return phonenumberformatted

print phonenumbergenerator()

```

I am getting the following error when I try to run this and I am not sure what I am doing incorrectly here:

`TypeError: 'long' object has no attribute '__getitem__'`