Permute
permute(index, length, seed)
Index into a permuted array with constant space and time complexity.
This function permutes an index i
into a range [0, l)
using a hash function. See
https://afnan.io/posts/2019-04-05-explaining-the-hashed-permutation/ for more details and
"Correlated Multi-Jittered Sampling" by Andrew Kensler for the original algorithm.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
index
|
int
|
The index to permute. |
required |
length
|
int
|
The range of the permuted index. |
required |
seed
|
int
|
The permutation seed. |
required |
Returns:
Type | Description |
---|---|
int
|
The permuted index in range(0, length). |
Source code in bionemo/core/data/permute.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
|