Question

(a) A sequence of random numbers can be generated by repeating the statement n- (5*n+3) mod 256 starting from the initial val
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer:

A)

#1 /usr/bin/ruby 2 $n-0#global variable 3- def rng 4 $n- (5*$n +3) % 256 #calculate return $n 6 end 8 puts rng #calling methoB)

$n-0 #global variable 3 def rng 4 sn- (5*$n +3) % 256 #calculate return $n 6 end 7 def makearray(size) a-Array.nen(size) #creC)

def zigzag(a) n- a.length for iin 0..n-2 for j if a[j]〉a[j+1] temp-a[j] in 0..n-i-2 a [j +1 ]=temp end end end while i<n-1 doD)

#1 /usr/bin/ruby $n-0 #global variable 3 def rng $n = (5*$n +3) % #calculate 256 4 return $n 6 end 7 def makearray(size) a-Ar14 def zigzag(a) n- a.length for iin 0..n-2 16 for j in 0..n-i-2 18 temp-a[j] 20 alj+1]-temp end end 23 24 end 25 1-0 while i$ruby main.rb 3 18 93 212 39 198 225 104 58 37 188 175 110 41 208 19 98 237 1644 408588527 9897513808618709213 131133549519111121222this is not a copy paste answer may i know what factor is incorrect in your point of view after your rely i will repost the answer

Add a comment
Know the answer?
Add Answer to:
(a) A sequence of random numbers can be generated by repeating the statement n- (5*n+3) mod 256 starting from the i...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a C++ program that simulates playing the Powerball game. The program will generate random numbers...

    Write a C++ program that simulates playing the Powerball game. The program will generate random numbers to simulate the lottery terminal generated numbers for white balls and red Powerball. The user will have the option to self-pick the numbers for the balls or let the computer randomly generate them. Set the Grand Prize to $1,000,000,000.00 in the program. Project Specifications Input for this project: Game mode choice – self pick or auto pick Five numbers between 1 and 69 for...

  • Hello I need help with this program. Should programmed in C! Program 2: Sorting with Pointers...

    Hello I need help with this program. Should programmed in C! Program 2: Sorting with Pointers Sometimes we're given an array of data that we need to be able to view in sorted order while leaving the original order unchanged. In such cases we could sort the data set, but then we would lose the information contained in the original order. We need a better solution. One solution might be to create a duplicate of the data set, perhaps make...

  • Please post screenshots only File Tools View CMSC 140 Common Projects Spring 2019(1) E - 3...

    Please post screenshots only File Tools View CMSC 140 Common Projects Spring 2019(1) E - 3 x Project Description The Powerball game consists of 5 white balls and a red Powerball. The white balls represent a number in the range of 1 to 69. The red Powerball represents a number in the range of 1 to 26. To play the game, you need to pick a number for each ball in the range mentioned earlier. The prize of winning the...

  • Deck of Cards Program I need help printing a flush, which is showing the top 5...

    Deck of Cards Program I need help printing a flush, which is showing the top 5 cards of the same suite. Below is the code I already have that answers other objectives, such as dealing the cards, and finding pairs. Towards the end I have attempted printing a flush, but I cannot figure it out. public class Shuffler {    /**    * The number of consecutive shuffle steps to be performed in each call    * to each sorting...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT