import turtle
import random
# 星星个数
n = 5099
# rgb小数转换为
turtle.colormode(255)
#
def stars(x, y, size, color):
turtle.penup()
turtle.goto(x, y)
turtle.pendown()
turtle.color(color, color)
turtle.begin_fill()
for i in range(5):
turtle.fd(size)
turtle.right(144)
turtle.end_fill()
# start
for i in range(n):
x = random.randint(-500, 500)
y = random.randint(-500, 500)
size = random.randint(1, 50)
r = random.randint(10, 255)
g = random.randint(10, 255)
b = random.randint(10, 255)
stars(x=x, y=y, size=size, color=(r,g,b))
turtle.done()