import random


def gen_point2d(diffusion, max_x, max_y, z_payload=0.0):
    """Generate a single centroid. A centroid may not be too close to the
    maximum value of the dimension, no closer than 2*diffusion"""
    return (random.uniform(2*diffusion, max_x-2*diffusion),
            random.uniform(2*diffusion, max_y-2*diffusion), z_payload)