import random


def random_point_triangle(p0,p1,p2):
  """ Uniformally Picks a point in a triangle 
  
  args:
    p0,p1,p2 (float,float) : absolute position of triangle vertex
  return:
    pr (float,float) : absolute position inside triangle
  """
  # Unwraping Points
  x0,y0 = p0
  x1,y1 = p1
  x2,y2 = p2
  # Picking and Adjusting Uniform Weights
  a0 = random.random()
  a1 = random.random()
  if a0+a1 > 1:
    a0, a1 = 1-a0, 1-a1
  # Calculating Associated Point
  xr = a0*(x1-x0)+a1*(x2-x0)+x0
  yr = a0*(y1-y0)+a1*(y2-y0)+y0
  return (xr,yr)