~ubuntu-branches/ubuntu/karmic/xprobe/karmic

« back to all changes in this revision

Viewing changes to src/xpmodules/alive_probe/ttl_calc/getrandom.cc

  • Committer: Bazaar Package Importer
  • Author(s): Richard Atterer
  • Date: 2005-02-22 22:54:24 UTC
  • mfrom: (1.2.1 upstream) (2.1.2 hoary)
  • Revision ID: james.westby@ubuntu.com-20050222225424-6cqy8rr45pkna819
Tags: 0.2.2-1
New upstream version

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "ttl_calc.h"
 
2
 
 
3
int TTL_Mod::getrandom(int limit)
 
4
{
 
5
    int rnum;
 
6
#ifdef OpenBSD
 
7
        arc4random();
 
8
        rnum = 1+arc4random()%limit;
 
9
        return rnum;
 
10
#endif
 
11
        struct timeval tp;
 
12
    struct timezone tzp;
 
13
    gettimeofday(&tp, &tzp);
 
14
    srand(tp.tv_usec);
 
15
    rnum=1+rand()%limit;
 
16
    return rnum;
 
17
}