"""
This is the implementation of the OGN node defined in OgnRandomPoints.ogn
"""
import numpy as np


class OgnRandomPointsPy:
    """
    Generate an array of the specified number of points at random locations within the bounding cube
    """

    @staticmethod
    def compute(db) -> bool:
        """Compute the outputs from the current input"""

        range_size = db.inputs.maximum - db.inputs.minimum
        point_count = db.inputs.pointCount
        db.outputs.points_size = point_count
        if point_count > 0:
            db.outputs.points = range_size * np.random.random_sample((point_count, 3)) + db.inputs.minimum

        return True
