cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can change your system assigned username to something more personal in your community settings. X

random selection

payman
14-Alexandrite

random selection

Hello,

How can I randomly select an element of a matrix ?

ACCEPTED SOLUTION

Accepted Solutions
Fred_Kohlhepp
23-Emerald I
(To:payman)

There is a function that returns a random number between ceertain limits. You colud use that and the ceil and floor functions to make it an integer, then use that as an index to the matrix.

View solution in original post

5 REPLIES 5
Fred_Kohlhepp
23-Emerald I
(To:payman)

There is a function that returns a random number between ceertain limits. You colud use that and the ceil and floor functions to make it an integer, then use that as an index to the matrix.

payman
14-Alexandrite
(To:Fred_Kohlhepp)

Thank you. It works.

Werner_E
25-Diamond I
(To:payman)

PAYMAN RAJAI wrote:

Hello,

How can I randomly select an element of a matrix ?

You create two integer random numbers within the valid ranges, one for row and the second for the column index.

1.png

payman
14-Alexandrite
(To:Werner_E)

what is the role of ORIGIN here?

Werner_E
25-Diamond I
(To:payman)

Just wanted to get sure that what I post works, whatever you have ORIGIN set to.

Default value for ORIGIN is zero which is perfectly OK and I IMHO there is no reason to change that, but some people like it to be set to one.

Announcements

Top Tags