Added randval instead of calling random.randrange a lot