This will never happen.
make sure you are running the latest version of your program, and make sure you didn't paste the same code at some other place in the same file. e.g. make sure you don't have a precompiled version of it. (e.g. change the file name and try again).
Update:
based on the comment by matthias, if you saved your file as random.py the above result could be reproduced.
# if you save the code below as random.py
import random
for i in range(1,10):
print(i)
# your output could be reproduced as below.
>>> python random.py
1
2
3
4
5
6
7
8
9
1
2
3
4
5
6
7
8
9
solution: change the file name or if you have to import it make sure you include the codition if __name__ == "__main__"
in before the for loop of your random.py