Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Does Any one know how to add Random Noise to an array of data in JAVA? I What to

ID: 640378 • Letter: D

Question

Does Any one know how to add Random Noise to an array of data in JAVA? I What to insert random data to every index of the array. The random number inserted cant be greater than or less than 1 of the original data point.

For Example if the number is 5. The random number can be between 4 - 6. This rule applies to every number in the array because we are trying to add a random number of noise after every index in the array to the array.

Below is the Data Im trying to add noise to.

This is acclerometer data in the X,Y,Z Directions.

Below is code where I multipled all the values in this data set by 2, but now I instead want add random noise.

public class MultiplyByTwo implements MetamorphicTransform {

    public List transform(List inputData)
    {

        for(int i=0; i             float[] array = inputData.get(i);

            for(int j =0;j                 array[j] = array[j] *2;
            }
            inputData.set(i, array);
        }
        return inputData;


    }
}

This is wait I have tried

(math.nextdouble() - 0.5) * 2

StepServiceTest.java × accelerometer.csv × 1.2552512, 4. 8248715, 8.365072, -0.0392266, 3.9618864, 9.767424,0 0.088259846, 3.89324, 9.767424,0 0.088259846, 3.8245933, 9.767424,0 -0.088259846, 3.5794272, 9.767424,0 -0.12748645, 3.5794272, 9.767424,0 0.12748645, 3.5107806, 9.816457,0 0.12748645, 3.4421341, 9.86549,0 0.16671304, 3.3636808, 9.796844,0 -0.16671304, 3.1283212, 9.60071,0 0.37265268, 3.079288, 9.4241905,0 0.5393657, 3.079288, 9.355544,0 0.60801226, 3.079288, 9.286898,0 0.6766588, 3.079288, 9.0515375, 0 0.6766588, 3.079288, 8.973084,0 -0.7256921, 3.1381278, 8.796565,0 -0.7256921, 3.1871612, 8.747532,0 0.7256921, 3.2361944, 8.747532,0 0.7649187, 3.2361944, 8.796565,0 0.7649187, 3.2361944, 8.835792,0 0.69627213, 3.2361944, 8.894631,0 0.48052585, 3.2361944, 9.0515375,0 0.4314926, 3.2361944, 9.120184, 0 0.38245934, 3.2361944, 9.179024, 0 0.38245934, 3.2361944, 9.2378645,0 0.38245934, 3.1871612, 9.2378645,0 0.38245934, 3.1871612, 9.169217,0 0.44129923, 3.1871612, 8.933858,0 0.5001391, 3.1871612, 8.678885,0

Explanation / Answer

public static short[][] brighten(short[][] orig, short amount) { Random random = new Random(); short[][] returnArray = new short[orig.length][orig[0].length]; for(int i = 0; i
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote