Is there a way to make a NxN array (so 2d array) of elements, where each element is an array of 3 numbers randomly chosen between 0 and 1?
Output should look something like this:
(0.2,0.45,0.98), (0.7,0.58,0.11) ...
(1.0,0.05,0.63, ...
.
.
.
etc.
I've been trying to do this but there must be a more elegant way. Code included below:
import numpy as np
import matplotlib.pyplot as plt
lat = []
for _ in range(2):
w = []
for _ in range(2):
a = np.random.uniform(0.0,1.0)
b = np.random.uniform(0.0,1.0)
c = np.random.uniform(0.0,1.0)
D = np.array([a,b,c])
w.append(D)
lat.append(w)
if _ >= 1:
np.hstack(lat)