rotate

fun rotate(vector: FloatArray, seed: Int)(source)

Apply a seeded random rotation to a vector in-place.

Uses the "random sign flip + fast Walsh-Hadamard transform" approach:

  1. Apply random +-1 sign flips (seeded)

  2. Apply normalized Walsh-Hadamard transform

This produces a near-uniform rotation in O(d log d) time.

Parameters

vector

Input/output vector (modified in place)

seed

Deterministic seed for reproducibility