TestingDocs.com
Software Testing website
  • Automation
    • Selenium
    • JBehave Framework
  • Tutorials
    • MySQL Tutorials
    • Testlink
    • Maven
    • Git
  • IDEs
    • IntelliJ IDEA
    • Eclipse
  • Flowcharts
    • Flowgorithm
    • Raptor
  • About

Raptor Flowchart

Simulation of probabilities die roll using Raptor Flowchart

Raptor Flowcharts

Overview

In this tutorial, we will perform a Simulation of probabilities die roll using Raptor Flowchart.

 

P(X) = \frac{Nnumber of Times X Rolled in the Experiment}{Total Number of Rolls in the Experiment}.

 

Total outcomes of a die roll = 6

P(roll) = 1/6

For Example P(4) = 1/6

Raptor Flowchart

Let’s run an experiment and draw a flowchart simulating the rolling a die for n=10000 times.

P(4)=Number of times the dire rolled 4/Total number of die

= Number of times the dire rolled 4)/n

We track each experiment with iteration. We loop each experiment for the n times. The raptor flowchart for the die simulation is shown below:

The number of times the die rolled 4 is tracked with variable P0f4.

P(4) = Pof4/n

Die Roll Simulation

 

 

Sample Output

The console output of the flowchart is:

Simulating Die Roll..P(4)
Probability of Die Roll 4 =0.1643
Theoretical value 1/6 = 0.1667

Die roll run output

 

Pseudocode:

/**
* NAME:
* DATE:
* FILE:
* COMMENTS:
*/

START
// declare variables
int iteration = 0;
int Pof4 = 0;
int n = 10000;
int dieRoll = 0;

PRINT(“Simulating Die Roll..P(4)”);
n = 10000;
Pof4 = 0;
iteration = 1;
WHILE (iteration <= n)
{
dieRoll = floor((Math.random() * 6) + 1);
iteration = iteration + 1;
IF (dieRoll == 4)
{
Pof4 = Pof4 + 1;
}
}
PRINT(“Probability of Die Roll 4 =” + Pof4 / n);
PRINT(“Theoretical value 1/6 = ” + 1 / 6);
END

Related Posts

Install RAPTOR Avalonia CentOS

Raptor Flowchart /

Install RAPTOR Avalonia on CentOS

RAPTOR Avalonia Edition Windows

Raptor Flowchart /

Download RAPTOR Avalonia Edition on Windows

RAPTOR Editions

Raptor Flowchart /

RAPTOR Editions

RAPTOR flowcart to write to a file output

Raptor Flowchart /

Write to a file with RAPTOR flowchart

Sum of Squares Array Elements Modular Approach

Raptor Flowchart /

Sum of Squares of Given Array Elements

‹ String Operations in Raptor Flowchart› Sum of Squares of Given Array Elements

Recent Posts

  • MS Access Data Types
  • Install RAPTOR Avalonia on CentOS
  • Download RAPTOR Avalonia Edition on Windows
  • npm doctor command
  • Build & Run CLion Project
  • Create New CLion C Project on Windows
  • Configure CLion Toolchains on Windows
  • Launch CLion IDE on Windows
  • Activate CLion IDE
  • CLion IDE for C/C++ Development

Back to Top

Links

  • Contact
  • Privacy Policy
  • Cookie Policy

www.TestingDocs.com

Go to mobile version