BEGINNER ASKS FOR HELP!!! [message #10945] |
Fri, 30 January 1998 00:00 |
Edoardo \"Dado\&
Messages: 1 Registered: January 1998
|
Junior Member |
|
|
Dear Sirs,
I've just started using IDL 5 and I would like to solve this problem I've
encountered.
I need to create a RANDOM square matrix that contains only three numbers 0,
1, and (-1). There are two constraints though. I would like to tell the
program before it creates this matrix what the (at least approximate) RATIO
of 1 / (-1) should be and HOW MANY (at least approximately) 1 and (-1)
(total) are on each row of the matrix.
For example, the input by the user would be:
NUMBER OF ELEMENTS PER ROW e.g., 6
RATIO OF 1 / (-1) e.g., 0.5 (at the level of the matrix not of the row)
NUMBER OF 1 AND (-1) (total) IN EACH ROW e.g., 3 (for example 0 0 0 1 1 -1)
I do not need the ratio and number of |1| per row to be exact, also an
approximation it's good.
Thanx for your help,
Dado
|
|
|