Shuffle
Simple Shuffle
This example uses the nada-numpy shuffle implementation to shuffle an array of four secret integers and return the shuffled values. This process preserves the original elements but places them in a different order.
- Nada program
- Test
- nada-test
src/shuffle_simple.py
loading...
tests/shuffle_simple_test.yaml
loading...
tests/shuffle_simple_test.py
loading...
Run and test the shuffle_simple program
1. Open "Nada by Example"
2. Run the program with inputs
from the test file
nada run shuffle_simple_test
3. Test the program with inputs
from the test file against the expected_outputs
from the test file
nada test shuffle_simple_test
More Shuffle Examples
This example demonstrates how the nada-numpy shuffling operation supports multiple data types, including Rational, SecretRational, PublicInteger, and SecretInteger. Shuffling can be applied using two approaches: the shuffle()
function or the built-in .shuffle()
method on arrays.
- Nada program
- Test
src/shuffle.py
loading...
tests/shuffle_test.yaml
loading...
Run and test the shuffle program
1. Open "Nada by Example"
2. Run the program with inputs
from the test file
nada run shuffle_test
3. Test the program with inputs
from the test file against the expected_outputs
from the test file
nada test shuffle_test