Fix for Django 1.4. Implemented randrange from Django 1.3.x sessions

"Ported" over randrange from Django's session middleware (1.3.x). It does a check for a system-based PRNG, but will fall back on Python's implementation.

For reference:
https://github.com/django/django/blob/stable/1.3.x/django/contrib/sessions/backends/base.py