summaryrefslogtreecommitdiff
path: root/sources/utils/VSRandom.java
blob: 088da4ff91aff74b92980c233ba4b3b1c9ab4778 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
 * VS is (c) 2008 by Paul C. Buetow
 * vs@dev.buetow.org
 */
package utils;

import java.util.Random;

// TODO: Auto-generated Javadoc
/**
 * The Class VSRandom.
 */
public final class VSRandom extends Random {
    
    /**
     * Instantiates a new vS random.
     * 
     * @param seedAdd the seed add
     */
    public VSRandom(long seedAdd) {
        super(seedAdd*System.currentTimeMillis()+seedAdd);
    }

    /* (non-Javadoc)
     * @see java.util.Random#nextInt()
     */
    public int nextInt() {
        return Math.abs(super.nextInt());
    }

    /**
     * Next long.
     * 
     * @param mod the mod
     * 
     * @return the long
     */
    public long nextLong(long mod) {
        return Math.abs((super.nextLong() + System.currentTimeMillis()) % mod);
    }
}