This guide shows you how to generate random numbers in JMP, from simple columns of random values to reproducible random samples. You’ll use JMP’s built-in random functions and the Random utility in the Tables menu. No prior scripting knowledge is needed, though a basic familiarity with JMP data tables helps.
What You’ll Need
- JMP (version 14 or later recommended; steps are identical in JMP 17 and 18)
- A data table open, or the willingness to create a new one
- For reproducible results: a fixed Random Seed (set via File > Preferences > General or in the formula)
Step-by-Step
Method 1: Add a Column of Random Numbers
- Open the data table where you want the random values. If you have no table, go to File > New > Data Table and add a few rows by right-clicking the row number area and choosing Add Rows (e.g., 10 rows).
- Right-click on the column header area (the gray bar above row 1) and select New Column.
- In the New Column window, name the column (e.g., RandomUniform).
- Click the Column Properties menu (the gear icon) and choose Formula.
- In the Formula editor, type one of the following functions (see Tips for the full list):
RandomUniform()– returns a number between 0 and 1.RandomInteger(1, 100)– returns an integer between 1 and 100 inclusive.RandomNormal(50, 10)– returns a normally distributed value with mean 50 and std dev 10.
- Click OK on the formula dialog, then OK on the New Column dialog. JMP immediately fills the column with random values based on the formula.
- To recalculate new values, go to Tables > Rows > Rerun Formulas (or press Ctrl+Shift+E on Windows, Cmd+Shift+E on Mac).
Method 2: Generate a Random Sample from an Existing Table
- Open the table you want to sample from.
- Go to Tables > Subset.
- In the Subset window, click the Random sample size radio button.
- Enter the number of rows you want (e.g., 50).
- Optionally, check Sample with replacement if you want duplicates allowed.
- Click OK. A new table appears with the randomly selected rows.
Method 3: Use the Random Seed for Reproducibility
- Before generating any random numbers, set a seed. In the formula editor, you can wrap your function:
RandomSeed(123); RandomUniform()– the semicolon separates expressions. - Alternatively, set a global seed by going to File > Preferences > General and entering a number in the Random Seed field. Click OK.
- Now when you run a formula or a Subset, the same random sequence will appear every time you repeat it with the same seed.
Common Mistakes
- Forgetting the parentheses –
RandomUniformwithout()will not evaluate; JMP treats it as a column reference. - Using
Random()incorrectly – JMP’sRandom()is a shortcut forRandomUniform(), but it is not a function in the formula editor; use the full name. - Expecting the same random numbers each time – without a seed, JMP uses a new seed every session, so results differ.
- Sampling without specifying size – in the Subset window, if you don’t select the random sample option, you’ll get all rows.
- Editing the formula and not recalculating – changing a formula only affects new rows unless you rerun formulas.
Tips
- Use
RandomInteger(a, b)for discrete values; note that both endpoints are included. - For a binary outcome (e.g., coin flip), use
RandomInteger(0, 1)orIf(RandomUniform() < 0.5, 0, 1). - To generate multiple random columns at once, create a formula column and then drag the formula to other columns, or use Cols > Standardize.
- For a random permutation of row numbers, add a formula column with
RandomUniform()and then sort by that column. - Set a seed in your JSL scripts with
Random Seed(123);for full reproducibility. - To generate random dates, use
Random Date()– it returns a date between 1900 and 2100 by default.
Troubleshooting
- Column shows all zeros or the same value – Check that the formula is correctly typed. If you see a red triangle with an error, click it to see the error message. Common issue: using a semicolon instead of a comma in function arguments.
- Random numbers change every time I edit the table – That's normal. To freeze the values, copy the column and paste it as values (right-click column > Copy, then right-click the column header > Paste and choose Values).
- Subset returns the same rows every time – You likely have a random seed set. To get different samples, change the seed or clear it in Preferences.
- Formula editor won't accept
RandomNormal– Make sure you type it exactly, with capital letters. If autocomplete doesn't show it, check your JMP version – it's available in all modern versions. - The random sample size field is grayed out – In the Subset window, you must first click the Random sample size radio button; otherwise the field is disabled.
Frequently Asked Questions
How do I generate a random number between 0 and 1 in JMP?
Use the formula RandomUniform(). It returns a decimal between 0 (inclusive) and 1 (exclusive).
Can I generate random integers in a specific range?
Yes. Use RandomInteger(min, max), for example RandomInteger(1, 6) for a die roll. Both endpoints are included.
How do I make my random numbers reproducible?
Set a random seed. In a formula, write RandomSeed(42); RandomUniform(). Or set a global seed in File > Preferences > General. The same seed gives the same sequence.
How do I generate a random sample without replacement?
Use Tables > Subset and select Random sample size. Leave the Sample with replacement checkbox unchecked (default).
What is the difference between Random() and RandomUniform()?
In JSL, Random() is a shortcut for RandomUniform(). In the formula editor, you must use RandomUniform() because Random() is not recognized as a formula function.
Can I generate random numbers from a custom distribution?
Yes. Use the Distribution platform (Analyze > Distribution) to fit a distribution, then use the Random button in the fitted distribution report to generate new random values from that fitted model. Alternatively, use JSL with functions like Random Gamma() or Random Exponential().
Related
- How to Not Rank Zeros in Excel: 4 Fixes
- Data Entry for Healthcare: What It Involves
- Random Number Between 1-50: How to Generate
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- Excel Accounting Format: How It Works and When to Use It ProperlyExcel’s Accounting number format displays monetary values with currency symbols and decimal points aligned in a column; apply…
- Outlook Email Archive: How to Save Messages SafelyTo archive an email in Outlook, select the message and choose Archive on the toolbar or ribbon; Outlook…
- Win R Shortcut: What It Does and How to Use ItThe Win + R shortcut opens the Run dialog box in Windows. Press the Windows key and the…
- Excel Shortcut to Go to a Named RangeIn Excel for Microsoft 365 on Windows, press Ctrl+G or F5 to open the Go To dialog, select…
- How to Color Values in Excel with Conditional FormattingTo color values in Excel, select the cells, then choose Home > Conditional Formatting to apply a color…
- Python Goal Seek Like Excel? Methods and ExamplesYes. Python can do the same basic job as Excel Goal Seek: adjust one input until a formula…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.