Documentation / CalcMe

  • Demos
  • Visit our website
  • Contact us
  • MathType

    • Wiris Quizzes

      • Learning Lemur

        • CalcMe

          • MathPlayer

            • Store FAQ

              • VPAT for the electronic documentation

                • MathFlow

                  • BF FAQ

                    • Miscellaneous

                      • Wiris Integrations

                        • Home
                        • CalcMe
                        • Commands
                        • Programming Functions
                        • Programming Functions

                        Random

                        Reading time: 1min

                        Nota

                        Working with statistics? See Random (Statistics).

                        Returns a random number. One can specify the seed using random_seed(Integer).

                        Syntax

                        random()
                        
                        random(Integer)
                        
                        random(Real)
                        
                        random(Integer, Integer)
                        
                        random(Real, Real)
                        

                        Description

                        Returns a random number in the interval (0,1).

                        Given an integer n, returns a random integer number in the interval [0,n) (if n is positive) or (n,0] (if n is negative).

                        Given a real x, returns a random real number in the interval [0,x) (if x is positive) or (x,0] (if x is negative).

                        Given two integers numbers a and b, returns a random integer in the interval [a,b].

                        Given two real numbers a and b, returns a random real number in the interval [a,b].

                        Atenció

                        Given two integers numbers a and b, if a>b the result will be a random decimal number between b and a.

                        Was this article helpful?

                        Yes
                        No
                        Give feedback about this article

                        Related Articles

                        • Programming Functions
                        • Append
                        • Belongs?
                        • Complement
                        • Constant list

                        Random

                        Nota Syntax Description Atenció

                        Making people’s STEM work more meaningful

                        MathType

                        • MathType for Office Tools
                        • MathType for Mac
                        • MathType for Microsoft 365
                        • MathType for Google Workspace
                        • MathType for LMS
                        • MathType for XML Editors
                        • Arabic notation
                        • Our products accessibility
                        • MathType is online

                        WirisQuizzes

                        Learning Lemur

                        Solutions for Education

                        • Blackboard Learn
                        • Brightspace by D2L
                        • Canvas
                        • Google Classroom
                        • Moodle
                        • Schoology

                        Solutions for Publishing Houses

                        Solutions for Technical Writers

                        Solutions for Chemistry

                        Integrations

                        • HTML Editors
                        • MathType in WordPress

                        Pricing

                        Company

                        Careers

                        Blog

                        Contact Us

                        Buy Now

                        Plugin Downloads

                        © Wiris 2025

                        • Cookie Settings
                        • Cookie Policy
                        • Terms of Use
                        • Privacy Policy / GDPR
                        • Student Data Privacy
                        • Compliance
                        • Powered by Helpjuice
                        Expand