Changeset 16991


Ignore:
Timestamp:
07/06/12 17:07:48 (11 years ago)
Author:
nit
Message:

[titan] add random funktion

Location:
titan
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • titan/plugins/catcatch/catcatch.h

    r16964 r16991  
    11#ifndef CATCATCH_H
    22#define CATCATCH_H
    3 
    4 int getrandom(int max)
    5 {
    6         srand(time(NULL));
    7         return (rand() % max);
    8 }
    93
    104int checktreffer(int nr, int* sum, int* cat, int* value)
  • titan/titan/filelist.h

    r16957 r16991  
    733733        if(maxfiles < 1) return NULL;
    734734
    735         srand(time(NULL));
    736         int r = rand() % maxfiles;
     735        int r = getrandom(maxfiles);
    737736        r++;
    738737
  • titan/titan/global.h

    r16960 r16991  
    11#ifndef GLOBAL_H
    22#define GLOBAL_H
     3
     4int getrandom(int max)
     5{
     6        srand(time(NULL));
     7        return (rand() % max);
     8}
    39
    410//check if swap is in flash(1) or not(0)
  • titan/titan/header.h

    r16922 r16991  
    522522
    523523//global.h
     524int getrandom(int max);
    524525int clearbit(int value, int bitpos);
    525526int checkbit(int value, int bitpos);
  • titan/titan/mediadb.h

    r16923 r16991  
    7272        struct mediadbfilter *node = mediadbfilter;
    7373
    74         srand(time(NULL));
    75         int r = rand() % maxentry;
     74        int r = getrandom(maxentry);
    7675        r++;
    7776
  • titan/titan/playlist.h

    r16662 r16991  
    518518        if(maxfiles < 1) return NULL;
    519519
    520         srand(time(NULL));
    521         int r = rand() % maxfiles;
     520        int r = getrandom(maxfiles);
    522521        r++;
    523522
     
    557556        if(max < 1) return NULL;
    558557
    559         srand(time(NULL));
    560         int r = rand() % max;
     558        int r = getrandom(max);
    561559        r++;
    562560
Note: See TracChangeset for help on using the changeset viewer.