dap4/d4servlet/src/main/java/dap4/servlet/RandomValue.java
public Object
    nextInteger(DapType basetype)
            throws DapException
    {
        TypeSort atomtype = basetype.getTypeSort();
        if(!atomtype.isIntegerType())
            throw new DapException("Unexpected type: " + basetype);
        boolean unsigned = atomtype.isUnsigned();
        switch (atomtype) {
        case Int8:
            return new byte[]{(byte) (random.nextInt(1 << 8) - (1 << 7))};
        case UInt8:
            return new byte[]{(byte) (random.nextInt(1 << 8) & 0xFF)};
        case Int16:
            return new short[]{(short) (random.nextInt(1 << 16) - (1 << 15))};
        case UInt16:
            return new short[]{(short) (random.nextInt(1 << 16))};
        case Int32:
            return new int[]{random.nextInt()};
        case UInt32:
            long l = random.nextLong();
            l = l & 0xFFFFFFFF;
            return new int[]{(int) l};
        case Int64:
            return new long[]{random.nextLong()};
        case UInt64:
            return new long[]{new BigInteger(64, random).longValue()};
        }
        throw new DapException("Unexpected type: " + basetype);
    }
public Object
    nextInteger(DapType basetype)
            throws DapException
    {
        TypeSort atomtype = basetype.getTypeSort();
        if(!atomtype.isIntegerType())
            throw new DapException("Unexpected type: " + basetype);
        boolean unsigned = atomtype.isUnsigned();
        switch (atomtype) {
        case Int8:
            return new byte[]{(byte) (random.nextInt(1 << 8) - (1 << 7))};
        case UInt8:
            return new byte[]{(byte) (random.nextInt(1 << 8) & 0xFF)};
        case Int16:
            return new short[]{(short) (random.nextInt(1 << 16) - (1 << 15))};
        case UInt16:
            return new short[]{(short) (random.nextInt(1 << 16))};
        case Int32:
            return new int[]{random.nextInt()};
        case UInt32:
            long l = random.nextLong();
            l = l & 0xFFFFFFFF;
            return new int[]{(int) l};
        case Int64:
            return new long[]{random.nextLong()};
        case UInt64:
            return new long[]{new BigInteger(64, random).longValue()};
        }
        throw new DapException("Unexpected type: " + basetype);
    }
return an integer type value (including long, but not floats)