Revision 6a522c49 libavutil/random_seed.c

View differences:

libavutil/random_seed.c
40 40

  
41 41
static uint32_t get_generic_seed(void)
42 42
{
43
    int last_t=0;
43
    clock_t last_t=0;
44 44
    int bits=0;
45 45
    uint64_t random=0;
46 46
    unsigned i;
47
    int s=0;
47
    float s=0.000000000001;
48 48

  
49 49
    for(i=0;bits<64;i++){
50
        int t= clock()>>s;
51
        if(last_t && t != last_t){
52
            if(i<10000 && s<24){
53
                s++;
50
        clock_t t= clock();
51
        if(last_t && fabs(t-last_t)>s || t==(clock_t)-1){
52
            if(i<10000 && s<(1<<24)){
53
                s+=s;
54 54
                i=t=0;
55 55
            }else{
56 56
                random= 2*random + (i&1);

Also available in: Unified diff