File: Random.h

package info (click to toggle)
tmatrix 1.4%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 244 kB
  • sloc: cpp: 1,214; ansic: 338; csh: 52; sh: 25; makefile: 8
file content (24 lines) | stat: -rw-r--r-- 599 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/*
 * Copyright (C) 2018-2021 Miloš Stojanović
 *
 * SPDX-License-Identifier: GPL-2.0-only
 */

#ifndef RANDOM_H
#define RANDOM_H

#include "DecimalFraction.h"
#include "Range.h"

namespace Random {
	// Returns a random integer in the range [range.min, range.max]
	int Random(Range<int> range);
	// Returns a random integer in the range [min, max]
	int Random(int min, int max);
	// Returns a random integer in the range [0, range-1]
	int Random(int range);
	// Returns a random decimal fraction in the range [range.min, range.max]
	DecimalFraction Random(Range<DecimalFraction> range);
}

#endif