Generate a large list of points with no duplicates

前端 未结 4 1259
悲&欢浪女
悲&欢浪女 2020-12-21 21:49

I want to create a large list containing 20,000 points in the form of:

[[x, y], [x, y], [x, y]]

where x and y can be any random integer bet

4条回答
  •  北海茫月
    2020-12-21 22:48

    Try this :

    import itertools
    x = range(0,10)
    aList =[]
    for pair in itertools.combinations(x,2):
        for i in range(0,10):
            aList.append(pair)
    print aList
    

    If you want point between 0-10 with all unique and stored in a list, or you You need it random order, then use some random function .

提交回复
热议问题