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

Flowgorithm

Flowgorithm Random Function

Overview

In this tutorial, we will learn Flowgorithm Random function. We can use the function to generate a random number in flowcharts. Random() is an intrinsic function. The function behavior is predefined by the Flowgorithm software.

Function Syntax

The general syntax of the function is as follows:

Random(n)

The function requires one input argument. Random function returns an integer randomly between 0 and n – 1.

The argument is the upper limit of the random number that might be generated with the function. The number of arguments must match the function parameters. Otherwise, we will get an error during the flowchart runtime.

Examples

Randomly generate 0, 1

In this section we will understand some examples that use the function.

For Example, Random(2) generates output of either 0 or 1 randomly. Below flowchart invokes the Random(2) function ten times and displays the function output to the console window. Notice that the output is random.

 

Random number Flowgorithm Flowchart 01

 

Random(10)  This function generates a random number between 0 – 9.

Below example flowchart invokes the Random() function ten times and displays the function output to the console window. Notice that the output is random.

Flowgorithm Random Function

Notice that the output of the function is not constant. The Random(10) function randomly generates a number within the interval [0,9].

Random numbers from 1 to 10

Sometimes, we do not want the zero number to be generated. For example, we may want to randomly generate numbers from 1 to 10 both inclusive. We can use the following expression:

Random(10) + 1

Dice Roll Example

There are six possible outcomes when we roll a fair six-sided die. The outcomes are 1,2,3,4,5,6. Dice roll randomly generates a number from 1 to 6. So, to simulate the dice roll we can use the following Flowgorithm expression:

Random(6) + 1

The probability of each outcome is 1/6.

—

Flowgorithm Tutorials

Flowgorithm flowchart tutorials on this website:

https://www.testingdocs.com/flowgorithm-flowchart-tutorial/

Flowgorithm Website

For more information on the Flowgorithm tool, please visit the official website at:

http://flowgorithm.org/

Related Posts

Print Triangle Pattern Flowchart

Flowgorithm /

Print Triangle Pattern Flowchart

Flowgorithm Breakpoint Symbol

Flowgorithm /

Flowgorithm Conditional Breakpoint Statement

File Read Declare Variables

Flowgorithm /

Flowgorithm Read Numbers from File Example

File Search Input File Flowgorithm

Flowgorithm /

Search Text File Flowchart Example

Flowgorithm Turtle Graphics Symbols

Flowgorithm /

Flowgorithm Turtle Graphics Symbols

› Flowgorithm Source File Format

Recent Posts

  • Update draw.io on Windows
  • 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