1 package civitas.crypto.algorithms;
2
3 import org.springframework.beans.factory.annotation.Autowired;
4 import org.springframework.stereotype.Controller;
5
6 import civitas.crypto.CryptoBase;
7
8 @Controller
9 public class GenerateRandomInt {
10
11 @Autowired
12 CryptoBase cryptoBase;
13
14 public int apply(final int n) {
15 if (n <= 0) {
16 return 0;
17 }
18 return cryptoBase.getRandomGenerator().nextInt(n);
19 }
20 }