Build a VI that generates an array containing 100 random integers between 0 and
ID: 3764090 • Letter: B
Question
Build a VI that generates an array containing 100 random integers between 0 and 30. The VI should contain controls/select that will allow the user to select the portion of the array to be displayed – for example, from index 10 to 26.
Hint: Use the Array Subset function [Array & Cluster menu] to extract the portion of the array.
Explanation / Answer
public class RandomInt { public static void main(String[] args) { int n1 = Integer.parseInt(args[0]); int n2 = Integer.parseInt(args[1]); double Random; if (n1 != n2) { if (n1 > n2) { Random = n2 + (Math.random() * (n1 - n2)); System.out.println("Your random number is: " + Random); } else { Random = n1 + (Math.random() * (n2 - n1)); System.out.println("Your random number is: " +Random); } } else { System.out.println("Please provide valid Range " +n1+ " " +n2+ " are equal numbers." ); } } }
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.