Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

- JMP User Community
- :
- Discussions
- :
- Combinations

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Oct 22, 2019 6:54 AM
(958 views)

Hello, I just want to ask how do i generate 6 random numbers ranging from 1 to 100 from which the user indicates the number of combinations to be generated?

- Tags:
- random number

1 ACCEPTED SOLUTION

Accepted Solutions

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

JMP has many pseudo-random number generators. Use this one:

`Random Integer( 1, 100 );`

You can construct a vector with the J() function. Here is a call to produce a column vector of six random variables:

`J( 6, 1, Random Integer( 1, 6 ) );`

I am not clear what you need when you say "from which a user indicates the number of combinations to be generated."

Learn it once, use it forever!

3 REPLIES 3

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

JMP has many pseudo-random number generators. Use this one:

`Random Integer( 1, 100 );`

You can construct a vector with the J() function. Here is a call to produce a column vector of six random variables:

`J( 6, 1, Random Integer( 1, 6 ) );`

I am not clear what you need when you say "from which a user indicates the number of combinations to be generated."

Learn it once, use it forever!

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Combinations

Thanks for the reply! What i meant is that when a user indicated number of

combinations, say if i input 3 as my combinations, it returns 3 column

vectors of the random numbers generated.

combinations, say if i input 3 as my combinations, it returns 3 column

vectors of the random numbers generated.

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Combinations

I see. That need is easily handled by the second argument to the J() function.

`J( 6, 3, Random Integer( 1, 6 ) );`

You can use variables instead of constants, too.

```
r = 6;
c = 3;
J( r, c, Random Integer( 1, 6 ) );
```

Learn it once, use it forever!

Article Labels

There are no labels assigned to this post.