diff options
author | Piotr Makal <pmakal> | 2021-06-28 12:25:40 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-06-28 12:35:43 +0300 |
commit | ab31c2432225f9e82fbfe6a15cef14e8f65d3f05 (patch) | |
tree | e806d9c6d5ffbbee58658ac3a44fb01d796cc052 /source/blender/blenlib/BLI_rand.h | |
parent | addb2034a7f8d795a7c26c9f43d0e430234e5a0f (diff) |
BLI_rand: support for randomizing bitmaps
Add utility functions:
- BLI_bitmap_randomize
- BLI_rng_shuffle_bitmap
Part of D11685
Diffstat (limited to 'source/blender/blenlib/BLI_rand.h')
-rw-r--r-- | source/blender/blenlib/BLI_rand.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_rand.h b/source/blender/blenlib/BLI_rand.h index ec74cef9311..f8627952628 100644 --- a/source/blender/blenlib/BLI_rand.h +++ b/source/blender/blenlib/BLI_rand.h @@ -71,6 +71,9 @@ void BLI_rng_shuffle_array(struct RNG *rng, unsigned int elem_size_i, unsigned int elem_tot) ATTR_NONNULL(1, 2); +void BLI_rng_shuffle_bitmap(struct RNG *rng, unsigned int *bitmap, unsigned int bits_tot) + ATTR_NONNULL(1, 2); + /** Note that skipping is as slow as generating n numbers! */ void BLI_rng_skip(struct RNG *rng, int n) ATTR_NONNULL(1); @@ -89,6 +92,9 @@ void BLI_array_randomize(void *data, unsigned int elem_tot, unsigned int seed); +void BLI_bitmap_randomize(unsigned int *bitmap, unsigned int bits_tot, unsigned int seed) + ATTR_NONNULL(1); + /** Better seed for the random number generator, using noise.c hash[] */ /** Allows up to BLENDER_MAX_THREADS threads to address */ void BLI_thread_srandom(int thread, unsigned int seed); |