subject
Computers and Technology, 06.04.2020 07:21 jhitotw

Review the following code for different random number generators:
Random rnd = new Random();
int month = rnd. Next(1, 13); // 1 <= month < 13
int dice = rnd. Next(1, 7); // 1 <= dice< 7
int card = rnd. Next(53); // 0 <= card< 53
Using what you know of programming, what do each of the three options indicate they are doing? What does the “big” largest number indicate about the way this coding language treats . rnd and maximums? When might you want a random number generator in a game?The unit discusses the weaknesses of copy-and-pasting code: it leads to errors when you forget to change a value or miss part of the section you meant to copy. Can you think of any other risks to “Copy Pasta?” Do you agree with the unit’s argument? Why or why not?

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 01:00
)a grad student comes up with the following algorithm to sort an array a[1..n] that works by first sorting the first 2/3rds of the array, then sorting the last 2/3rds of the (resulting) array, and finally sorting the first 2/3rds of the new array. 1: function g-sort(a, n) . takes as input an array of n numbers, a[1..n] 2: g-sort-recurse(a, 1, n) 3: end function 4: function g-sort-recurse(a, `, u) 5: if u ⒠` ≤ 0 then 6: return . 1 or fewer elements already sorted 7: else if u ⒠` = 1 then . 2 elements 8: if a[u] < a[`] then . swap values 9: temp ↠a[u] 10: a[u] ↠a[`] 11: a[`] ↠temp 12: end if 13: else . 3 or more elements 14: size ↠u ⒠` + 1 15: twothirds ↠d(2 ◠size)/3e 16: g-sort-recurse(a, `, ` + twothirds ⒠1) 17: g-sort-recurse(a, u ⒠twothirds + 1, u) 18: g-sort-recurse(a, `, ` + twothirds ⒠1) 19: end if 20: end function first (5 pts), prove that the algorithm correctly sorts the numbers in the array (in increasing order). after showing that it correctly sorts 1 and 2 element intervals, you may make the (incorrect) assumption that the number of elements being passed to g-sort-recurse is always a multiple of 3 to simplify the notation (and drop the floors/ceilings).
Answers: 3
question
Computers and Technology, 22.06.2019 15:00
When designing content as part of your content marketing strategy, what does the "think" stage represent in the "see, think, do, care" framework?
Answers: 3
question
Computers and Technology, 23.06.2019 14:30
Select the correct answer. what does it indicate when a website displays https instead of http? a. the website is secure. b. there is no secure sockets layer. c. the secure sockets layer is hidden. d. the website is not secure.
Answers: 1
question
Computers and Technology, 24.06.2019 02:00
What is a loop? a. a collection of function definitions at the top of a program b. a line of code that defines a variable and assigns it a value c. a program that opens the turtle graphics window d. a block of code that repeats a specific number of times
Answers: 1
You know the right answer?
Review the following code for different random number generators:
Random rnd = new Random();
Questions
question
Social Studies, 04.02.2021 03:30
question
Mathematics, 04.02.2021 03:30
question
Mathematics, 04.02.2021 03:30
question
English, 04.02.2021 03:30
question
Spanish, 04.02.2021 03:30
question
Physics, 04.02.2021 03:30
Questions on the website: 13722363