~ubuntu-branches/ubuntu/trusty/blender/trusty

« back to all changes in this revision

Viewing changes to source/blender/blenlib/BLI_rand.h

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2013-03-06 12:08:47 UTC
  • mfrom: (1.5.1) (14.1.8 experimental)
  • Revision ID: package-import@ubuntu.com-20130306120847-frjfaryb2zrotwcg
Tags: 2.66a-1ubuntu1
* Resynchronize with Debian (LP: #1076930, #1089256, #1052743, #999024,
  #1122888, #1147084)
* debian/control:
  - Lower build-depends on libavcodec-dev since we're not
    doing the libav9 transition in Ubuntu yet

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
struct RNG;
41
41
typedef struct RNG RNG;
42
42
 
43
 
struct RNG*     rng_new                 (unsigned int seed);
44
 
void            rng_free                (struct RNG* rng);
45
 
 
46
 
void            rng_seed                (struct RNG* rng, unsigned int seed);
47
 
void rng_srandom(struct RNG *rng, unsigned int seed);
48
 
int                     rng_getInt              (struct RNG* rng);
49
 
double          rng_getDouble   (struct RNG* rng);
50
 
float           rng_getFloat    (struct RNG* rng);
51
 
void            rng_shuffleArray(struct RNG *rng, void *data, int elemSize, int numElems);
52
 
 
53
 
        /** Note that skipping is as slow as generating n numbers! */
54
 
void            rng_skip                (struct RNG *rng, int n);
55
 
 
56
 
        /** Seed the random number generator */
57
 
void    BLI_srand               (unsigned int seed);
58
 
 
59
 
        /** Better seed for the random number generator, using noise.c hash[] */
60
 
void    BLI_srandom             (unsigned int seed);
61
 
 
62
 
        /** Return a pseudo-random number N where 0<=N<(2^31) */
63
 
int             BLI_rand                (void);
64
 
 
65
 
        /** Return a pseudo-random number N where 0.0<=N<1.0 */
66
 
double  BLI_drand               (void);
67
 
 
68
 
        /** Return a pseudo-random number N where 0.0f<=N<1.0f */
69
 
float   BLI_frand               (void);
70
 
 
71
 
        /** Fills a block of memory starting at \a addr
72
 
         * and extending \a len bytes with pseudo-random
73
 
         * contents. This routine does not use nor modify
74
 
         * the state of the BLI random number generator.
75
 
         */
76
 
void    BLI_fillrand    (void *addr, int len);
77
 
 
78
 
        /** Shuffle an array randomly using the given seed.
79
 
         * contents. This routine does not use nor modify
80
 
         * the state of the BLI random number generator.
81
 
         */
82
 
void    BLI_array_randomize     (void *data, int elemSize, int numElems, unsigned int seed);
83
 
 
84
 
 
85
 
        /** Better seed for the random number generator, using noise.c hash[] */
86
 
        /** Allows up to BLENDER_MAX_THREADS threads to address */
87
 
void    BLI_thread_srandom      (int thread, unsigned int seed);
88
 
 
89
 
        /** Return a pseudo-random number N where 0<=N<(2^31) */
90
 
        /** Allows up to BLENDER_MAX_THREADS threads to address */
91
 
int             BLI_thread_rand         (int thread);
92
 
 
93
 
        /** Return a pseudo-random number N where 0.0f<=N<1.0f */
94
 
        /** Allows up to BLENDER_MAX_THREADS threads to address */
95
 
float   BLI_thread_frand        (int thread);
96
 
 
97
 
 
98
 
 
99
 
#endif
100
 
 
 
43
struct RNG *BLI_rng_new(unsigned int seed);
 
44
void        BLI_rng_free(struct RNG *rng);
 
45
 
 
46
void        BLI_rng_seed(struct RNG *rng, unsigned int seed);
 
47
void        BLI_rng_srandom(struct RNG *rng, unsigned int seed);
 
48
int         BLI_rng_get_int(struct RNG *rng);
 
49
double      BLI_rng_get_double(struct RNG *rng);
 
50
float       BLI_rng_get_float(struct RNG *rng);
 
51
void        BLI_rng_shuffle_array(struct RNG *rng, void *data, int elemSize, int numElems);
 
52
 
 
53
/** Note that skipping is as slow as generating n numbers! */
 
54
void        BLI_rng_skip(struct RNG *rng, int n);
 
55
 
 
56
/** Seed the random number generator */
 
57
void    BLI_srand(unsigned int seed);
 
58
 
 
59
/** Better seed for the random number generator, using noise.c hash[] */
 
60
void    BLI_srandom(unsigned int seed);
 
61
 
 
62
/** Return a pseudo-random number N where 0<=N<(2^31) */
 
63
int     BLI_rand(void);
 
64
 
 
65
/** Return a pseudo-random number N where 0.0<=N<1.0 */
 
66
double  BLI_drand(void);
 
67
 
 
68
/** Return a pseudo-random number N where 0.0f<=N<1.0f */
 
69
float   BLI_frand(void);
 
70
 
 
71
/** Fills a block of memory starting at \a addr
 
72
 * and extending \a len bytes with pseudo-random
 
73
 * contents. This routine does not use nor modify
 
74
 * the state of the BLI random number generator.
 
75
 */
 
76
void    BLI_fillrand(void *addr, int len);
 
77
 
 
78
/** Shuffle an array randomly using the given seed.
 
79
 * contents. This routine does not use nor modify
 
80
 * the state of the BLI random number generator.
 
81
 */
 
82
void    BLI_array_randomize(void *data, int elemSize, int numElems, unsigned int seed);
 
83
 
 
84
 
 
85
/** Better seed for the random number generator, using noise.c hash[] */
 
86
/** Allows up to BLENDER_MAX_THREADS threads to address */
 
87
void    BLI_thread_srandom(int thread, unsigned int seed);
 
88
 
 
89
/** Return a pseudo-random number N where 0<=N<(2^31) */
 
90
/** Allows up to BLENDER_MAX_THREADS threads to address */
 
91
int     BLI_thread_rand(int thread);
 
92
 
 
93
/** Return a pseudo-random number N where 0.0f<=N<1.0f */
 
94
/** Allows up to BLENDER_MAX_THREADS threads to address */
 
95
float   BLI_thread_frand(int thread);
 
96
 
 
97
#endif  /* __BLI_RAND_H__ */