Free Essay

Random Numbers in C++

In: Computers and Technology

Submitted By Frances606
Words 1434
Pages 6
Random numbers in C++ and The Pythagorean Theorem
Literature Review


Literature Review
The increase in technological advancements has seen a similar increase in the number of computer programs which are designed to command a computer to carry out a given specified task. The number of languages that are available which are used in this creation and design include Java Script, C++, Java and Sage. It is worth noting that while these are the most notable ones, the number of languages in computer programming design might be higher. However, computer programmers argue that the rest of the languages, despite being of equal capabilities, have not met the required usage to warrant widespread literature review.
Hiscotta is particularly critical of this in 10 programming languages you should learn in 2014 by asserting that The field of computer programming is particularly important with regards to the increasing use and adoption of the internet use. This has seen the field carve out a distinct field of study which is purely dedicated to the understanding of how the programs work. The first step in the design of the computer programs is the basic understanding of the dynamics that are involved in the working of computers. This forms the initial step which will eventually be accompanied by software writing involving random numbers with the sole undertaking of coming up with a particular outcome.
Of critical importance is the adherence to source code representation which is an essential requirement in computer programming. The integration of distinct and diverse concepts, especially signs and graphs has led to the field to being viewed as an art as opposed to being an engineering sector. The computers programs work by carrying out a regular and constant stream of bytes which are in the form of bytes in a manner that has been modified to be understood by the computer. This code makes it quite a task for human beings to directly input the information in the computers, a process which has been harnessed by computer programmers around the world to counter hacking activities. This source code is usually carried out in a transitional process for the instructions before finally being generated for use by the computer in code format. This involves the use of binary numbers in the representation of information and as such, this is different from the machine code.
The profound role of a computer programmer, therefore, is to design a source code that can successfully be converted into a machine code and which will be interpreted by the computer. This is made possible by the use of random numbers which are used for the generation of data encryption keys. In addition to this, the keying of random numbers is used in the selection of distinguishing random samples from a populated set of data, whose application develops an aesthetic atmosphere in the fields of literature as well as in music. The importance of random numbers in this case can be underlined in the gambling and gaming industry in a bid to increase the chances of unpredictability in the games. This sequence of random numbers comes up with a series of values that are totally independent and do not rely on each other.
Taylor and George through their extensive research posit that in the event that the output results fail to match the instructions that have been input, then such a failure has been corrupted. The two main approaches that are used in the generation of random numbers are the Pseudo- Random Number Generators commonly abbreviated as (PRNG) and True Random Number Generators, abbreviated as (TRNG).
Haar in Introduction to Randomness and Random Numbers posits that C++ programming language is arguably the most used programming language in various hardware and operating systems canvass. The usage of C++ is premised on the distinguished factors of efficiency as a compiler to the initial native code and this allows it to be applicable in a wide array of sectors. Microsoft is a global company that is regarded as being among the major producers in mass capacity of the free C++ as well as proprietary software. This further highlights its proven reliability and widespread usage. An extensive research has been conducted on the faults that are to be associated with the use and application of C++. Most of the literature reviews in existence concerning this aspect seem to contend that between 50% and 54% of the mistakes and errors that are reported are to be exclusively to be associated with the users as opposed to C++. A further 73% - 86% of the errors that are reported have been attributed to an error in the installation process of the software. In the generation of random numbers in C++, C++ is equipped with a distinct pseudo number generator mechanism within itself.
A mathematic scholar by the name of Pythagoras is credited with the creation of the Pythagorean Theorem. This principle centrally establishes the basic principle that in any right angled triangle, the additions of squares of the alternative sides of the hypotenuse gives a result which is equivalent to the square of the hypotenuse side. In algebraic form, this can be represented as a2+b2=c2. In this equation, a and b represent the legs of the right angled triangle while c represents the hypotenuse. It is this theory that forms the basis of the Euclidian Geometry which is used in the determination of the distance between the two sides. Critiques to this theorem has received considerable literature review and this is primarily premised on the basis that the determination can only be carried out for locations that are in a perfectly right angled dimension position. However, such critical variations can be outlaid by the proof that has been given as to the validity of this equation.
The validity of the Pythagorean Theorem is premised on graphical undertakings. Pythagoras further used a number of dissections in a bid to prove the validity of his theorem. Currently, research has established the presence of more than a hundred alternative ways of proving the theory. It is worth noting however, that majority of literature reviews have focused on four major concepts which include the Bhsakara’s first proof, Bhsakara’s second proof, Pythagoras’ proof and the Garfield’s proof.
Head in his dissection in A Pythagorean Theorem asserts that the Pythagoras’ proof is evidently the most profound one and relies on the mathematical computation of the squares of the legs of any right angled triangle to come up with the square of the hypotenuse of the triangle. In a similar manner, Bhsakara’s First proof is also premised on the concept of dissection and bears close similarity to the one that was used by Pythagoras. This uses triangles. In the second mathematician’s proof, Bhaskara used a right angled triangle where he proceeds to outline and altitude from and towards the hypotenuse side. This second proof bears an even closer similarity to the Pythagorean proof as compared to the first proof. Garfield’s proof stands out particularly as it was developed by the then twentieth president of the United States of America five years before he was elected to the presidency.
Summarily, while the literature reviews that are available seem to agree on the basic understandings of the C++ application and the Pythagorean theorem, the contention seems to be in the integration of the concepts in the use in the current diversified world, particularly owing to the widespread internet usage. This was drawn apparent by Haar in Introduction to Randomness and Random Numbers. However, such distinctions are outweighed substantially by the appreciation of the concepts in this regard.

Alex, Random number generation, 2014. Available from: <>. [7 December 2008].
Bogomonly, A, Pythagorean Theorem, 2012. Available from: <>. [3 October 2014].
Haahr, D. M, Introduction to Randomness and Random Numbers, 2013. Available from: <>. [3 October 2014].
Head, A, Pythagorean Theorem, 2012. Available from: <>. [3 October 2014].
Hiscotta, R, 10 Programming Languages You Should Learn in 2014, 2014. Available from: <>. [3 October 2014].
Laine, O, What Is Computer Programming?, 2013. Available from: <>. [3 October 2014].
Taylor, G & George, C, Behind Intel’s New Random-Number Generator, 2011. Available from: <>. [3 October 2014].

Similar Documents

Free Essay

Random Numbers

...Random numbers in C++ and The Pythagorean Theorem Name Course Date Random numbers in C++ and The Pythagorean Theorem Introduction Computer programs in light of the technological advances that have been made, arguably make up for the most important concepts in such developments. A set of instructions designed to assist a computer to prefer a given task is referred to as a computer program. There are numerous languages used to create/design computer for instance Java Script, Java, C++, SQL and Sage (Laine, 2013). Computer programming is defined as a process of developing a working set of computer instructions meant to aid the computer in the performance of a given task. Computer programming starts with the formulation of a valid computer problem. This process is then followed by the development of an executable computer program, for instance Firefox Web Brower (Laine 2013). It is worth noting that there are other programs in the same realm. Computer programming is a diverse field that is of utmost importance in the modern world, especially with the continuous expansion of the internet. Perhaps the relevance of this can be underlined by the fact that computer programming has carved out as a course on itself. Computer programming is offered under several courses studied in colleges and universities (Laine, 2013). Computer programming is not only for computer students but for all who use computers on a day to day basis. This is by extension everyone since the...

Words: 9330 - Pages: 38

Premium Essay

Chapter 5—Discrete Probability Distributions

...descriptive statistic b. probability function c. variance d. random variable ANS: D PTS: 1 TOP: Discrete Probability Distributions 2. A random variable that can assume only a finite number of values is referred to as a(n) a. infinite sequence b. finite sequence c. discrete random variable d. discrete probability function ANS: C PTS: 1 TOP: Discrete Probability Distributions 3. A probability distribution showing the probability of x successes in n trials, where the probability of success does not change from trial to trial, is termed a a. uniform probability distribution b. binomial probability distribution c. hypergeometric probability distribution d. normal probability distribution ANS: B PTS: 1 TOP: Discrete Probability Distributions 4. Variance is a. a measure of the average, or central value of a random variable b. a measure of the dispersion of a random variable c. the square root of the standard deviation d. the sum of the squared deviation of data elements from the mean ANS: B PTS: 1 TOP: Discrete Probability Distributions 5. A continuous random variable may assume a. any value in an interval or collection of intervals b. only integer values in an interval or collection of intervals c. only fractional values in an interval or collection of intervals d. only the positive integer values in an interval ANS: A PTS: 1 TOP: Discrete Probability Distributions 6. A description of the distribution of the values of a random variable and their associated......

Words: 9797 - Pages: 40

Free Essay

Pdf, Docx

...can begin to use probabilistic ideas in statistical inference and modelling, and the study of stochastic processes. Probability axioms. Conditional probability and independence. Discrete random variables and their distributions. Continuous distributions. Joint distributions. Independence. Expectations. Mean, variance, covariance, correlation. Limiting distributions. The syllabus is as follows: 1. Basic notions of probability. Sample spaces, events, relative frequency, probability axioms. 2. Finite sample spaces. Methods of enumeration. Combinatorial probability. 3. Conditional probability. Theorem of total probability. Bayes theorem. 4. Independence of two events. Mutual independence of n events. Sampling with and without replacement. 5. Random variables. Univariate distributions - discrete, continuous, mixed. Standard distributions - hypergeometric, binomial, geometric, Poisson, uniform, normal, exponential. Probability mass function, density function, distribution function. Probabilities of events in terms of random variables. 6. Transformations of a single random variable. Mean, variance, median, quantiles. 7. Joint distribution of two random variables. Marginal and conditional distributions. Independence. iii iv 8. Covariance, correlation. Means and variances of linear functions of random variables. 9. Limiting distributions in the Binomial case. These course notes explain the naterial in the syllabus. They have been “fieldtested” on the class of 2000. Many of the......

Words: 29770 - Pages: 120

Premium Essay


...A FIRST COURSE IN PROBABILITY This page intentionally left blank A FIRST COURSE IN PROBABILITY Eighth Edition Sheldon Ross University of Southern California Upper Saddle River, New Jersey 07458 Library of Congress Cataloging-in-Publication Data Ross, Sheldon M. A first course in probability / Sheldon Ross. — 8th ed. p. cm. Includes bibliographical references and index. ISBN-13: 978-0-13-603313-4 ISBN-10: 0-13-603313-X 1. Probabilities—Textbooks. I. Title. QA273.R83 2010 519.2—dc22 2008033720 Editor in Chief, Mathematics and Statistics: Deirdre Lynch Senior Project Editor: Rachel S. Reeve Assistant Editor: Christina Lepre Editorial Assistant: Dana Jones Project Manager: Robert S. Merenoff Associate Managing Editor: Bayani Mendoza de Leon Senior Managing Editor: Linda Mihatov Behrens Senior Operations Supervisor: Diane Peirano Marketing Assistant: Kathleen DeChavez Creative Director: Jayne Conte Art Director/Designer: Bruce Kenselaar AV Project Manager: Thomas Benfatti Compositor: Integra Software Services Pvt. Ltd, Pondicherry, India Cover Image Credit: Getty Images, Inc. © 2010, 2006, 2002, 1998, 1994, 1988, 1984, 1976 by Pearson Education, Inc., Pearson Prentice Hall Pearson Education, Inc. Upper Saddle River, NJ 07458 All rights reserved. No part of this book may be reproduced, in any form or by any means, without permission in writing from the publisher. Pearson Prentice Hall™ is a trademark of Pearson Education, Inc...

Words: 121193 - Pages: 485

Premium Essay

Quantitative Techniques

... a. 4 and 3 b. 4.8 and 3 c. 4.8 and 3 1/2 d. 4 and 3 1/2 e. 4 and 3 1/3 2. A distribution of 6 scores has a median of 21. If the highest score increases 3 points, the median will become __. a. 21 b. 21.5 c. 24 d. Cannot be determined without additional information. e. none of these 3. If you are told a population has a mean of 25 and a variance of 0, what must you conclude? a. Someone has made a mistake. b. There is only one element in the population. c. There are no elements in the population. d. All the elements in the population are 25. e. None of the above. 4. Which of the following measures of central tendency tends to a. be most influenced by an extreme score? b. median c. mode d. mean 5. The mean is a measure of: a. variability. b. position. c. skewness. d. central tendency. e. symmetry. 6. Suppose the manager of a plant is concerned with the total number of man-hours lost due to accidents for the past 12 months. The company statistician has reported the mean number of man-hours lost per month but did not keep a record of the total sum. Should the manager order the study repeated to obtain the desired information? Explain your answer clearly. Answer: No--the estimate that he would get using the mean number per month would most likely be accurate enough...

Words: 28909 - Pages: 116

Premium Essay


...CHAPTER 6 RANDOM VARIABLES PART 1 – Discrete and Continuous Random Variables OBJECTIVE(S): • Students will learn how to use a probability distribution to answer questions about possible values of a random variable. • Students will learn how to calculate the mean and standard deviation of a discrete random variable. • Students will learn how to interpret the mean and standard deviation of a random variable. Random Variable – Probability Distribution - Discrete Random Variable - The probabilities of a probability distribution must satisfy two requirements: a. b. Mean (expected value) of a discrete random variable [pic]= E(X) = = 1. In 2010, there were 1319 games played in the National Hockey League’s regular season. Imagine selecting one of these games at random and then randomly selecting one of the two teams that played in the game. Define the random variable X = number of goals scored by a randomly selected team in a randomly selected game. The table below gives the probability distribution of X: Goals: 0 1 2 3 4 5 6 7 8 9 Probability: 0.061 0.154 0.228 0.229 0.173 0.094 0.041 0.015 0.004 0.001 a. Show that the probability distribution for X is legitimate. b. Make a histogram of the probability distribution. Describe what you see. 0.25 0.20 0.15 0.10 ...

Words: 3495 - Pages: 14

Premium Essay


...Distributions CONTENTS STATISTICS IN PRACTICE: CITIBANK 5.1 RANDOM VARIABLES Discrete Random Variables Continuous Random Variables 5.2 DEVELOPING DISCRETE PROBABILITY DISTRIBUTIONS 5.3 EXPECTED VALUE AND VARIANCE Expected Value Variance 5.4 BIVARIATE DISTRIBUTIONS, COVARIANCE, AND FINANCIAL PORTFOLIOS A Bivariate Empirical Discrete Probability Distribution Financial Applications Summary 5.5 BINOMIAL PROBABILITY DISTRIBUTION A Binomial Experiment Martin Clothing Store Problem Using Tables of Binomial Probabilities Expected Value and Variance for the Binomial Distribution POISSON PROBABILITY DISTRIBUTION An Example Involving Time Intervals An Example Involving Length or Distance Intervals HYPERGEOMETRIC PROBABILITY DISTRIBUTION 5 5.6 5.7 74537_05_ch05_p215-264.qxd 10/8/12 4:05 PM Page 219 5.1 Random Variables 219 Exercises Methods SELF test 1. Consider the experiment of tossing a coin twice. a. List the experimental outcomes. b. Define a random variable that represents the number of heads occurring on the two tosses. c. Show what value the random variable would assume for each of the experimental outcomes. d. Is this random variable discrete or continuous? 2. Consider the experiment of a worker assembling a product. a. Define a random variable that represents the time in minutes required to assemble the product. b. What values may the random variable assume? c. Is the random variable discrete or continuous? Applications SELF......

Words: 11596 - Pages: 47

Free Essay

Statistics - Binomial and Poisson Probability

...Objectives 1. Understand the concepts of a random variable and a probability distribution. 2. Be able to distinguish between discrete and continuous random variables. 3. Be able to compute and interpret the expected value, variance, and standard deviation for a discrete random variable. 4. Be able to compute and work with probabilities involving a binomial probability distribution. 5. Be able to compute and work with probabilities involving a Poisson probability distribution. A random variable is a numerical description of the outcome of an experiment. A discrete random variable may assume either a finite number of values or an infinite sequence of values. A continuous random variable may assume any numerical value in an interval or collection of intervals. Discrete Probability Distributions n Random Variables n Discrete Probability Distributions n Expected Value and Variance n Binomial Distribution n Poisson Distribution [pic] A random variable is a numerical description of the outcome of an experiment. A discrete random variable may assume either a finite number of values or an infinite sequence of values. A continuous random variable may assume any numerical value in an interval or collection of intervals. Example: JSL Appliances n Discrete random variable with a finite number of values n Let x = number of TVs sold at the store in one......

Words: 789 - Pages: 4

Premium Essay


...assembling a product. We can define a random variable as x equals to the time in minutes to assemble the product b) The possible outcomes for this experiment is the worker may assemble the product from the first second to whatever how long it takes him or her to assemble the product. Therefore, the random variable x may assume any number greater than zero in minutes, meaning any positive number. It can be noted as x > 0. c) In the experiment x is assuming to be all the value greater than zero variable, so the experimental outcomes are based on a measurement of scale. Thus, the random variable x is a continuous random variable. Answer 2 a) The number of questions answered correctly are the possible outcomes. The experiment is based on a 20-question examination, so all the possible values the random variable can assume are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, and 20. All the possible outcomes are range from 0 to 20, that means the random variable x can take a finite number of value, therefore, x is a discrete random variable b) The random variable x representing the number of cars arriving a tollbooth may assume all the following values 0, 1, 2, 3,…, n cars in one hour. The values of the random variable x is infinite as x may assume the value of n cars in one hour, it is a discrete random variable because it is bound to stop at the number n cars. c) 0, 1, 2, 3, 4, 5,……, 50 are all the values the random variable x may......

Words: 1448 - Pages: 6

Premium Essay


...Chapter 9 Random Numbers This chapter describes algorithms for the generation of pseudorandom numbers with both uniform and normal distributions. 9.1 Pseudorandom Numbers 0.814723686393179 Here is an interesting number: This is the first number produced by the Matlab random number generator with its default settings. Start up a fresh Matlab, set format long, type rand, and it’s the number you get. If all Matlab users, all around the world, all on different computers, keep getting this same number, is it really “random”? No, it isn’t. Computers are (in principle) deterministic machines and should not exhibit random behavior. If your computer doesn’t access some external device, like a gamma ray counter or a clock, then it must really be computing pseudorandom numbers. Our favorite definition was given in 1951 by Berkeley professor D. H. Lehmer, a pioneer in computing and, especially, computational number theory: A random sequence is a vague notion . . . in which each term is unpredictable to the uninitiated and whose digits pass a certain number of tests traditional with statisticians . . . 9.2 Uniform Distribution Lehmer also invented the multiplicative congruential algorithm, which is the basis for many of the random number generators in use today. Lehmer’s generators involve three integer parameters, a, c, and m, and an initial value, x0 , called the seed. A September 16, 2013 1 2 sequence of integers is defined by xk+1 = axk + c mod m. Chapter 9. Random......

Words: 5522 - Pages: 23

Premium Essay

Probability Distribution 2. Random Variables 3. Probability Distribution of a Discrete Random Variable 4. The Binomial Probability Distribution 5. The Hypergeometric Probability Distribution 6. The Poisson Probability Distribution 7. Continuous Random Variables 8. The Normal Distribution 9. The Normal Approximation to the Binomial Distribution 2 1 7.10.2015 г. An experiment is a process that, when performed, results in one and only one of many observations. These observations are called the outcomes of the experiment. The collection of all outcomes for an experiment is called a sample space. Table 1 Examples of Experiments, Outcomes, and Sample Spaces Experiment Outcomes Sample Space Toss a coin once Head, Tail S= { Head, Tail} Roll a die once 1, 2, 3, 4, 5, 6 S= {1, 2, 3, 4, 5, 6} Toss a coin twice HH, HT, TH, TT S= { HH, HT, TH, TT} Play lottery Win, Lose S= {Win, Lose} Take a test Pass, Fail S= {Pass, Fail} Select a worker Male, Female S= { Male, Female} 3 A random variable is a variable whose value is determined by the outcome of a random experiment. A random variable that assumes countable values is called a discrete random variable. A random variable that can assume any value contained in one or more intervals is called a continuous random variable. 4 2 7.10.2015 г. Examples of discrete random variables 1. The number of heads obtained in three tosses of a coin 2. The number......

Words: 4560 - Pages: 19

Free Essay


... Master of IT Engineering PROBABILITY AND RANDOM PROCESSES FOR ENGINEERING ASSIGNMENT Topic: BASIC RANDOM PROCESS Group Member: 1, Chor Sophea 2, Lun Sokhemara 3, Phourn Hourheng 4, Chea Daly | Academic year: 2014-2015 I. Introduction Most of the time many systems are best studied using the concept of random variables where the outcome of random experiment was associated with some numerical value. And now there are many more systems are best studied using the concept of multiple random variables where the outcome of a random experiment was associated with multiple numerical values. Here we study random processes where the outcome of a random experiment is associated with a function of time [1]. Random processes are also called stochastic processes. For example, we might study the output of a digital filter being fed by some random signal. In that case, the filter output is described by observing the output waveform at random times. Figure 1.1 The sequence of events leading to assigning a time function x(t) to the outcome of a random experiment Thus a random process assigns a random function of time as the outcome of a random experiment. Figure 1.1 graphically shows the sequence of events leading to assigning a function of time to the outcome of a random experiment. First we run the experiment, then we observe......

Words: 2863 - Pages: 12

Premium Essay

Chapter 1 Stats is called: A. Descriptive statistics B. Inferential statistics C. Analytical statistics D. All of the above 2. The _________________ random variables yield categorical responses so that the responses fit into one category or another. A. Quantitative B. Discrete C. Continuous D. Qualitative 3. Which of the following is a qualitative/categorical variable? A. The number of pets owned by a family. B. The number of doors on a car. C. Your favourite TV show. D. Your IQ score. 4. Which of the following is a quantitative variable? A. The make of a TV. B. A person's gender. C. The distance from one city to another (in km). D. A person’s educational background. 5. The manager of the customer service division of a major consumer electronics company is interested in determining whether the customers who have purchased a DVD player made by the company over the past 12 months are satisfied with their products, the possible responses to the question "How much time do you use the DVD player every week on the average?" are values from a A. discrete numerical random variable. B. continuous numerical random variable. C. categorical random variable. D. Cannot answer because of lake of information 6. The classification of student major (accounting, economics, management, marketing, other) is an example of A. a categorical random variable. B. a discrete random variable. C. a continuous random variable. D. Cannot answer because of lake of......

Words: 542 - Pages: 3

Premium Essay


...Integer Step 1: A function contains three parts: a header, a body, and a return statement. The first is a function header which specifies the data type of the value that is to be returned, the name of the function, and any parameter variables used by the function to accept arguments. The body is comprised of one or more statements that are executed when the function is called. In the following space, complete the following: (Reference: Writing Your Own Functions, page 225). a. Write a function with the header named addTen. b. The function will accept an Integer variable named number. c. The function body will ask the user to enter a number and the add 10 to the number. The answer will be stored in the variable number. d. The return statement will return the value of number. Function a.Integer a.addTen (b.integer number) Display “Enter a number:” Input c.number Set c.number = number + 10 Return d.15 Step 2: In the following space, write a function call to your function from Step 1....

Words: 2530 - Pages: 11

Premium Essay


...AVU-PARTNER INSTITUTION MODULE DEVELOPMENT TEMPLATE PROBABILITY AND STATISTICS Draft By Paul Chege Version 19.0, 23rd March, 2007 C. TEMPLATE STRUCTURE I. INTRODUCTION 1. TITLE OF MODULE Probability and Statistics 2. PREREQUISITE COURSES OR KNOWLEDGE Secondary school statistics and probability. 3. TIME The total time for this module is 120 study hours. 4. MATERIAL Students should have access to the core readings specified later. Also, they will need a computer to gain full access to the core readings. Additionally, students should be able to install the computer software wxMaxima and use it to practice algebraic concepts. 5. MODULE RATIONALE Probability and Statistics, besides being a key area in the secondary schools’ teaching syllabuses, it forms an important background to advanced mathematics at tertiary level. Statistics is a fundamental area of Mathematics that is applied across many academic subjects and is useful in analysis in industrial production. The study of statistics produces statisticians that analyse raw data collected from the field to provide useful insights about a population. The statisticians provide governments and organizations with concrete backgrounds of a situation that helps managers in decision making. For example, rate of spread of diseases, rumours, bush fires, rainfall patterns, and population changes. On the other hand, the study of......

Words: 8620 - Pages: 35