Revision bfe3676f libavutil/random.c

View differences:

libavutil/random.c
1 1
/*
2 2
 * Mersenne Twister Random Algorithm
3 3
 * Copyright (c) 2006 Ryan Martell
4
 * Based on A C-program for MT19937, with initialization improved 2002/1/26. Coded by
5
 * Takuji Nishimura and Makoto Matsumoto.
4
 * Based on a C program for MT19937, with initialization improved 2002/1/26.
5
 * Coded by Takuji Nishimura and Makoto Matsumoto.
6 6
 *
7 7
 * This file is part of FFmpeg.
8 8
 *
......
23 23

  
24 24

  
25 25
/**
26
see http://en.wikipedia.org/wiki/Mersenne_twister for an explanation of this algorithm.
27
*/
26
 * See http://en.wikipedia.org/wiki/Mersenne_twister
27
 * for an explanation of this algorithm.
28
 */
28 29
#include <stdio.h>
29 30
#include "random.h"
30 31

  
......
52 53
        unsigned int prev= state->mt[index - 1];
53 54
        state->mt[index] = (1812433253UL * (prev ^ (prev>>30)) + index) & 0xffffffff;
54 55
    }
55
    state->index= index; // will cause it to generate untempered numbers the first iteration
56
    state->index= index; // Will cause it to generate untempered numbers in the first iteration.
56 57
}
57 58

  
58 59
#if LIBAVUTIL_VERSION_MAJOR < 50
......
62 63
}
63 64
#endif
64 65

  
65
/** generate AV_RANDOM_N words at one time (which will then be tempered later) (av_random calls this; you shouldn't) */
66
/** Generates AV_RANDOM_N words at one time (which will then be tempered later).
67
 * av_random calls this; you shouldn't. */
66 68
void av_random_generate_untempered_numbers(AVRandomState *state)
67 69
{
68 70
    int kk;

Also available in: Unified diff