SHUFFLE_VECTOR
The SHUFFLE_VECTOR node returns a vector that is randomly shuffled. Params: default : Vector The vector to shuffle. Returns: out : Vector Shuffled 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.
Parameters
----------
default : Vector
The vector to shuffle.
Returns
-------
Vector
Shuffled input vector
"""
shuffledVector = permutation(default.v)
return Vector(v=shuffledVector)
Example
Having problems 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.