SHUFFLE_VECTOR
The SHUFFLE_VECTOR node returns a vector that is randomly shuffledInputs
------
default : Vector
The input vectorParams:Returns:out : VectorShuffled input vector
Python Code
from numpy.random import permutation
from flojoy import flojoy, Vector
@flojoy
def SHUFFLE_VECTOR(
default: Vector,
) -> Vector:
"""The SHUFFLE_VECTOR node returns a vector that is randomly shuffled
Inputs
------
default : Vector
The input vector
Returns
-------
Vector
Shuffled input vector
"""
shuffledVector = permutation(default.v)
return Vector(v=shuffledVector)
Example
Having problem with this example app? Join our Discord community and we will help you out!
In this example, we generate a vector type data using LINSPACE
node.
Using SHUFFLE_VECTOR
, we randomly shuffle the elements and visualize it using SCATTER
node.