File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
mihxil-algebra/src/main/java/org/meeuw/math/abstractalgebra/linear Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -106,11 +106,13 @@ public M newElement(@Square E[][] matrix) throws InvalidElementCreationException
106
106
public M nextRandom (Random random ) {
107
107
while (true ) {
108
108
try {
109
- List < E > list = new ArrayList <>( );
109
+ E [][] values = elementStructure . newMatrix ( dimension , dimension );
110
110
for (int i = 0 ; i < dimension ; i ++) {
111
- list .add (elementStructure .nextRandom (random ));
111
+ for (int j = 0 ; j < dimension ; j ++) {
112
+ values [i ][j ] = elementStructure .nextRandom (random );
113
+ }
112
114
}
113
- return newElement (( E []) list . toArray () );
115
+ return newElement (values );
114
116
} catch (InvalidElementCreationException ie ) {
115
117
//ignored
116
118
}
You can’t perform that action at this time.
0 commit comments