Randomise vertices in xy-plane
Change the value of NurbsObject().data.splines[a].points[b].co, checking points[b].select if you'd like to restrict to only currently selected points:
def AnisotropicRandomizePoints(scale=(1,1,1,0), points=None):
    &quot;&quot;&quot;Anisotropically randomize the coordinates of NURBS points.
    Accepts a sequence of length four as its first argument,
    with the first three elements scaling the randomization
    applied to X, Y, and Z coordinates and the fourth element
    scaling the randomization applied to W respectively. Uses a
    given list of points if specified, otherwise uses all selected
    points in the active object if in Edit Mode or all points
    in the active object otherwise.&quot;&quot;&quot;
    import random
    import bpy
    if points is None:
        points = [p for s in bpy.context.object.data.splines for p in s.points if p.select or bpy.context.mode not in ('EDIT_CURVE', 'EDIT_SURFACE')]
    points = [*points]
    for p in points:
        for i, v in enumerate(p.co):
            p.co[i] = v + (random.random()*2-1)*scale[i]

(Do AnisotropicRandomizePoints(scale=(1,1,0,0)) to restrict randomisation to the XY plane.)