public int getRandom() {
        // int rand=(int) (Math.random()*a.size());
        // return a.get(rand).val;
        ListNode rr=head;
        if(x!=null){
            count++;
            rr=x;
            x=x.next;
        }else{
            int rand=(int)(Math.random()*count);
            for(int i =1; i<=rand; i++)rr=rr.next;
        }
        return rr.val;

    }
@param head The linked list's head.
    Note that the head is guaranteed to be not null, so it contains at least one node.
src/problems/medium/LinkedListRandomNode.java