Explore BrainMass
Share

# Random Number Generation

From ancient times when coins were flipped and dice rolled for gambling, people have needed random number generation. Formally defined, a random number generator is a physical or computational device which generates an array of symbols or numbers with no pattern. There has always been a large demand for random data generation from everything requiring unpredictable results, from the lottery, to computer simulations to cryptography to statistical sampling. There are two main methods of generating random numbers:

• physically

Physically-based random number generators take advantage of naturally-occurring randomization. True examples of these are difficult to find, but the most commonly-used ones are atomic or subatomic phenomena such as radioactive decay, whose randomness is guaranteed as a result of the laws of quantum mechanics. It is necessary with this method to ensure you are compensating for any biases that may occur as a result of measuring this random natural process, however.

• computationally

This method makes use of algorithms designed to produce unpredictable results by performing operations on a 'seed' key that is given as input. They are often complex, but also known as 'pseudo-random number generators' as there is a relation between the values and the seed, however distant.

As well as produce random numbers, there exists a type of tool called a randomness extractor which turns randomly-arranged data into a uniform distribution. A cryptography hash function is a good example of such a tool.

### Guessing Game

Write a program in C++ to play a guessing game with the user. The program should be able to make a guess about the chosen number by the user and ask whether the guessed number is above or below the chosen number. If the guess is correct the program should report the number of tries and the correctly guessed number. As an advanc

### Using Comments to Document Programs. & What is a Test Plan?

Hello World is a simple Java program. (This information came from the Oracle website Java tutorial.) What information must be included in the comments at the top of a program? What is a test plan? I am looking for general answer not specific to this or any other program. /** * The HelloWorldApp class implements an appli

See the attached file. Write a program to check out how good my new random number generator generates numbers. A good generator produces evenly distributed numbers over some range. Determine how well these numbers are dispersed between 1 and 100. generate 10,000 random numbers between 1 and 100 and count how many times eac

### Increase/decrease the diameter of the inner circle of stars

// Fig. 12.31: Shapes2JPanel.java // Demonstrating a general path. import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.geom.GeneralPath; import java.util.Random; import javax.swing.JPanel; public class Shapes2JPanel extends JPanel { // draw general paths public void pa

### Java - Permutation Programs

Write a program that produces random permutations of the numbers 1 to 10. To generate a random permutation, you need to fill an array with the numbers 1 to 10 so that no two entries of the array have the same contents. You could do it by brute force, by calling Random.nextInt until it produces a value that is not yet in the arra

### Chiper code in C++

You have TWO OPTIONS on how to send in this assignment (either way will get you the same credit): [1] Either by HAND e.g., WRITE OUT a little Table/Figure (use Excel Worksheet? MS Word "Table"? However you want to do it) that will illustrate the 2 rows of Alphanumeric letters as follows (with OUT the "

### Random Number Generation: Windows Program

Write a Windows Form program to guess against a list of randomly generated numbers. Create a Form, name it GuessANumber and create a randomly generated array containing 100 integer numbers. See examples for random number generation at the following sites: http://www.dotnetperls.com/random http://www.c-sharpcorner.com/Uplo

### C# and Java Applications: Random Number Generation Examples

1. Write a C# application that generates a 3-digit random number 100 times. Display the output for each of the generated numbers and the sum of all 100 numbers. Every 10th number you should display a String consisting of any phrase of your choice concatenated with the current random number. A possible partial output for your p

### Country names parser and simple hash table in C++

I am trying to create a program to help me with my business. Here is a list of the countries around the world: http://www.arrl.org/files/file/DXCC/dxcclist_2011e.txt Parse this list as appropriate to retrieve just the country names. Remove any country names that involve more than a single word. Use the remaining list of si

### Object Oriented Program in JAVA to play Game of Life

Consider a rectangular matrix of cells, each of which may contain an organism. If the matrix is viewed as extending indefinitely in both directions, then each cell has eight neighbors, the eight cells surrounding it. In each generations births and deaths occur according to following rules: 1. An organism is born in any empty ce

### Java Program to Print a String in Distributed Manner

Design a Java "Hello World" program that should mimic distributed processing of printing the string "Hello World!" on display. For doing this the main() method should just create 5 threads and store references to them in an array of threads, which will be passed to each thread for communication purposes. Then the main() metho

### Information Security: DES and Rijndael Protocol

1.What is DES? What is triple DES? How did the Rijndael protocol enhance DES? 2.What are substitution ciphers? How do they differ from one-time pads (OTP)? Which is better for the IS manager to employ and why?

### Write a HTML script that plays "guess the number" game.

Write a HTML script that plays a "guess the number" game as follows. The program chooses the number to be guessed by selecting a random integer in the range of 1 to 1000. The script displays the prompt "Guess a number between 1 and 1000" next to a text field. The player types a guess into the text field and clicks a button

### Write a C# Windows Form program to pick the larger of randomly generated numbers.

Write a C# Windows Form program to pick the larger of randomly generated numbers. 1. Create a Form that contains two randomly generated parallel arrays, each containing 100 numbers. 2. The random number generation for both arrays will be done in a method, both when the arrays are first populated and when they have to be re

### Write a Java program to generate 20 random numbers between 1 and 50, write them to a binary file and then read the numbers back from the file to display them on the screen along with the frequency of occurrence of each number in a nice format.

Write a program to generate 20 random numbers between 1 and 50, write them to a binary file and then read the numbers back from the file to display them on the screen along with the frequency of occurrence of each number in a nice format. Use the Random class in the java.util package for random number generation. Please go th

### The objective of this Java program is to accept two random numbers from the user and then multiply the two numbers. The application is comprehensive and includes comments as well as documentation.

I need help with this: Exercise 6.30: Computers are playing an increasing role in education. Write a program that will help an elementary school learn multiplication. Use a Random object to produce two positive one-digit integers. The program should then prompt the user with a question, such as How much is 6 ti

### Binary tree pre and post order traversals in Java

Write a Java program that loads 12 random integers with the values between 1 and 100 into a tree. Apart from building the tree - List the values that have been inserted. - Print the tree out in preorder traversal order and then again in postorder traversal order. - Print another line showing how deep the tree has become.

### Programming in Java II

Question #1: Develop a program that prompts the user to guess the outcome of a die throw. Then throw a die (using a random number generator) and inform the user if they guessed the correct outcome. Count the number of correct guesses. Develop the program using a separate class for the die. Your program should contain two separat

### Find / resolve c program segmental fault

Need some assistance finding / repairing segmentation fault in program. The attached program uses a random number generator, orders numbers hi to low, displays hi number, low number and should display mean and median numbers from random list. I run "./random2 1 100 20" to generate 20 numbers between 1 and 100, (./random2 min

### Download a shareware version of some commercial software. Design a plan for converting the shareware version to a full version without paying one cent. If it is not possible for the shareware to be converted to a full version, analyze what kind of techniques the software vendor has used to protect it. In addition, use some of the techniques mentioned in the attached document to do some black-box testing on the software and report your results in the report.

Download a shareware version of some commercial software. Design a plan for converting the shareware version to a full version without paying one cent. If it is not possible for the shareware to be converted to a full version, analyze what kind of techniques the software vendor has used to protect it. In addition, use some of th

### Testing Shareware Product- Black Box Testing

Download a shareware version of some commercial software. Design a plan for converting the shareware version to a full version without paying one cent. If it is not possible for the shareware to be converted to a full version, analyze what kind of techniques the software vendor has used to protect it. (You may use your intuition

### Random-number generation - Java

Write an application that uses random-number generation to create sentences. Use four arrays of strings called article, noun, verb and preposition. Create a sentence by selecting a word at random from each array in the following order: article, noun, verb, preposition, article and noun. As each word is picked, concatenate it to

### Recursive Binary Search Java

Modify Fig. 16.4 to use recursive method recursiveBinarySearch to perform a binary search of the array (see attached file). The method should receive the search key, starting index and ending index as arguments. If the search key is found, returns its index in the array. If the search key is not found, return -1.

### Multicast applications - Minimalist Internet Multicast Service Model

Name several multicast applications. Which of these applications are well-suited for the minimalist Internet multicast service model? Why? Which applications are not particularly well-suited for this service model?

### Write a program in Java to simulate the generation of lottery (lotto) numbers.

The Lottery Problem: A lottery requires that you select six different numbers from the integers 1 to 49. Write a Java program that will do this for you and generate five sets of six numbers as a result. For generating random numbers you can use the random() static method of class Math. It returns a double so you will need to

### Networks - Access Protocols/PKI

1. Provide the different access protocols, such as Carrier Sense Multiple Access (CSMA), Carrier Sense Multiple Access with Collision Detection (CSMA/CD) and Wavelength Division Multiplexing Access (WDMA). Where would these types of protocols would be used? Explain the situations with examples. 2. Describe an example of the

### Java program which defines two unconstrained arrays of user defined length

Write a Java program which defines two unconstrained arrays of user defined length n, that contain n Random numbers each and which outputs the addition of pairs of elements. For example, given {1, 2, 3} and {4, 5, 6} the output would be {5, 7, 9}. Please use well commented code.

### Division method for a hash function

Please review the problem and explain each step of the solution listed below, and give me an example of an application which this property would be undesirable in a hash function. problem ---------- Consider a version of the division method in which h(k) = k mod m, where m = (2^p) -1 and k is a character string interpreted

### Multipling using Rand

Use Rand to produce 2 positive one digit integers.

### Multidimensional Arrays and Vectors

A certain auto dealership sells ten different models of autos and employs eight salespersons. A record of sales for each month can be represented by a table in which each row contains the number of sales of each model by a given salesperson and each column contains thenumber of sales by each salesperson fo a given model. Write