import random


def RandomGrid(N):
    """Generate a random raster with N points."""
    pl = []
    while N > 0:
        a = random.random()
        b = 1.0 - random.random()
        if b < a: c = a;  a = b;  b = c
        pl.append((a, b-a, 1.0-b))
        N -= 1
    return pl