random.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:iutils 作者: inconvergent 项目源码 文件源码
def darts_rect(n, xx, yy, w=1, h=1, dst=0):


  ## remove new nodes that are too close to other
  ## new nodes

  visited = set()
  dartsxy = random_points_in_rectangle(n, xx, yy, w, h)
  tree = kdt(dartsxy)
  near = tree.query_ball_point(dartsxy, dst)
  jj = []
  for j,n in enumerate(near):

    if len(visited.intersection(n))<1:
      jj.append(j)
      visited.add(j)

  res = dartsxy[jj,:]
  return res
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号