class RandomGraph implements Generator {

    protected int numberOfNodes = 50;
    protected double wiringProbability = 0.05;
    protected ProgressTicket progress;
    protected boolean cancel = false;

    @Override
    public void generate(ContainerLoader container) {<FILL_FUNCTION_BODY>}

    @Override
    public String getName() {
        return NbBundle.getMessage(RandomGraph.class, "RandomGraph.name");
    }

    @Override
    public GeneratorUI getUI() {
        return Lookup.getDefault().lookup(RandomGraphUI.class);
    }

    public int getNumberOfNodes() {
        return numberOfNodes;
    }

    public void setNumberOfNodes(int numberOfNodes) {
        if (numberOfNodes < 0) {
            throw new IllegalArgumentException("# of nodes must be greater than 0");
        }
        this.numberOfNodes = numberOfNodes;
    }

    public double getWiringProbability() {
        return wiringProbability;
    }

    public void setWiringProbability(double wiringProbability) {
        if (wiringProbability < 0 || wiringProbability > 1) {
            throw new IllegalArgumentException("Wiring probability must be between 0 and 1");
        }
        this.wiringProbability = wiringProbability;
    }

    @Override
    public boolean cancel() {
        cancel = true;
        return true;
    }

    @Override
    public void setProgressTicket(ProgressTicket progressTicket) {
        this.progress = progressTicket;
    }
}


        int max = numberOfNodes;
        if (wiringProbability > 0) {
            max += numberOfNodes - 1;
        }
        Progress.start(progress, max);
        int progressUnit = 0;
        Random random = new Random();

        NodeDraft[] nodeArray = new NodeDraft[numberOfNodes];
        for (int i = 0; i < numberOfNodes && !cancel; i++) {
            NodeDraft nodeDraft = container.factory().newNodeDraft();
            container.addNode(nodeDraft);
            nodeArray[i] = nodeDraft;
            Progress.progress(progress, ++progressUnit);
        }

        if (wiringProbability > 0) {
            for (int i = 0; i < numberOfNodes - 1 && !cancel; i++) {
                NodeDraft node1 = nodeArray[i];
                for (int j = i + 1; j < numberOfNodes && !cancel; j++) {
                    NodeDraft node2 = nodeArray[j];
                    if (random.nextDouble() < wiringProbability) {
                        EdgeDraft edgeDraft = container.factory().newEdgeDraft();
                        edgeDraft.setSource(node1);
                        edgeDraft.setTarget(node2);
                        container.addEdge(edgeDraft);
                    }
                }
                Progress.progress(progress, ++progressUnit);
            }
        }

        Progress.finish(progress);
        progress = null;
    
<no_super_class>