Welcome to Algotester!
What is Algotester?
Online judge with a lot of interesting problems of various difficulty.
Platform for problem preparation.
Platform for organizing ICPC and IOI styles contests.
Platform for organizing optimization contests.
What should I do to start using Algotester?
To start working with Algotester you have to register. To do that, go to the registration page using the button in the top right corner. Fill in the "User Name" field. Your User Name should be unique so that the system could identify you. It should:
Be unique.
Contain between 4 and 47 symbols.
Contain uppercase or lowercase English letters, digits, dots or underscores.
Start with a letter.
In fields "First Name" and "Last Name" enter your real first and last names. In field "Email" enter your email address. You should have access to your email, to confirm the registration. In field "Password" enter your password. You will use it to log in to the system. The password should contain between 4 and 47 symbols and be strong. Confirm your password in field "Confirm password". Agree to the Algotester Terms and Conditions.
After filling out the form, go to your email and wait for the account confirmation email. Confirm your account.
I want to try to solve some easy problems, and if I like it, maybe some more.
Full list of problems in archive you can find in section Problems on the left menu.
The easiest problem in archive — problem A plus B. Below, we provide sample solutions to this problem on all available programming languages.
To submit your solution, you have to choose a way to submit your code (file or source code) and compiler. Depending on the method of submit, you have to attach a file or paste source code of your program into the corresponding field, and click "Submit".
In the table below submission form, you will see all your submissions to that problem, as well as the results of those submissions. You can see all details of your submissions. You can see submitted code, compiler output and result of every test. Testing will continue until first failed test case.
In section "Successful Solutions" you can see solutions and their results from all users who solved this problem.
I got a Wrong Answer on the problem A plus B.
This means that your solution is incorrect, it means there is a valid test case on which your solution result is different from the judge’s solution result. The list of all possible judge verdicts:
Wrong Answer There is a valid test case on which your solution result is different from the judge’s solution result. Runtime Error The program ended unexpectedly (for example, there was an attempt to divide by 0, or to index outside the array). Time Limit There is a valid test case in which the program execution time exceeds the limit specified in the statement. Memory Limit There is a valid test case in which the program memory consumption exceeds the limit specified in the statement. Compilation Error The compiler is unable to compile your code. To see compiler output, go to compiler tab in the solution view. Internal error There is a judge error. Algotester team is trying to fix it. Idle Time Limit Exceeded Interactor waited too long for user output. This error is occurred when interaction protocol is violated. Accepted This is the only verdict that is good for you - the program passed all test cases and is accepted by the judge! How to find problems?
In section Problems, you can:
Sort problems by the number of people who solved it. Easy problems are solved more frequently than hard ones.
Choose theme or complexity using tags. Click on a tag or write down the theme in the search field.
Find a specific problem by its ID, name, or source (contest name in which this problem was used).
Where can I find hints if I struggle with a problem?
In section Analysis you can find written editorial to some problems. Also, you can find video editorials in our YouTube.
Can I compare my progress with other members?
Yes, a full list of users, sorted by the number of solved problems, is available on the left menu in section Rank. Also, you can find online queue with yours and other users solutions in section Solution queue.
Archive is good, but how to participate in real contest?
In Ivan Franko National University of Lviv (and others Lviv universities), you can participate in regular onsite contests using Algotester. Subscribe to us on Facebook, Twitter and Telegram to not to miss any event.
What languages can be used to solve problems?
Language Version Compiler Arguments C++ 14 g++ 6.4.0 -O2
C++ 17 g++ 10.3.0 -O2 -std=c++17
C++ 20 g++ 11.2.0 -O2 -std=c++20
C++ 23 g++ 14.1.0 -O2 -std=c++23
C gcc 14.1.0 -O2 -std=gnu23
C# Mono C# compiler version 6.4.0.198 /o+ /r:System.Numerics.dll
Java 8 openjdk 1.8.0 Java 19 openjdk 19 Java 23 openjdk 23 Pascal Free Pascal Compiler 3.2.2 -O2 -Sh
Python Python 3.8.1 -O
PyPy PyPy 7.3.0 with GCC 7.4.0 -O
F# F# Compiler version 4.1 -r:System.Numerics.dll --optimize+ --crossoptimize+
Go go version go1.20.5 Node.js Node.js v20.0.0 Ruby ruby 3.2.2 Rust rustc 1.70.0 --edition 2021 -C opt-level=3
Examples of problem "A plus B" solutions written on available programming languages:
C++
C
C#
Java
Pascal
Python / PyPy
F#
let main() = let line = System.Console.ReadLine() let numbers = line.Split(' ') let a = System.Int32.Parse(numbers.[0]) let b = System.Int32.Parse(numbers.[1]) System.Console.WriteLine(a + b) main()
Go
Node.js
function Main(input) { s = input.split(" "); var a = parseInt(s[0]); var b = parseInt(s[1]); console.log('%d', a+b); } Main(require("fs").readFileSync("/dev/stdin", "utf8"));
Ruby
Rust
use std::io; fn main() { // Read input from stdin let mut input = String::new(); io::stdin() .read_line(&mut input) .expect("Failed to read input."); // Parse input string to numbers let mut numbers = input.split_whitespace(); let a: i32 = numbers.next().unwrap().parse().expect("Invalid number entered for a."); let b: i32 = numbers.next().unwrap().parse().expect("Invalid number entered for b."); // Calculate the sum let sum = a + b; // Write the sum to stdout println!("{}", sum); }
The process of creating a problem at Algotester
In the top right corner of the site, open the tab «Problems (Writer)». In this section you will see all problems you have created, as well as problems whose author has designated you as a contributor. Also, you will see 5 buttons: «Create», «Delete», «Reorder», «Rejudge» and «Submit».
Press the button «Create». You will see a problem creation tab. It is necessary to specify 4 mandatory fields for creating a problem: «Name», «Time (sec.)», «Memory (MiB)» and «Output (MiB)». Enter the name of the problem in the «Name» field. Name requirements:
Avoid using any special characters in problem names (
$&*%
)Must not be too long (7 words or fewer)
The problem name must be unique. There should be no problem with the same name in the archive.
Note that the problem statement will have the name that you specify when creating the statement. In the time (sec.) field, enter the maximum time in seconds for one test to run. Standard time limit is 2 seconds. The time limit should be up to 7 seconds.
In the "Memory (MiB)" field, enter the RAM usage limit for one test. The standard memory limit is 256 MB. The memory limit should be from 128 MB to 1024 MB. The memory limit must be a power of two.
If the time or memory limits are less than standard, then make sure that the problem is solvable in Python and Java.
In the "Output (MiB)" field, enter the maximum output size of the program on one test. The default output value is 1 Mebibyte.
Limits to the problem should be chosen so that they are at least 2 times greater than the author’s solution requires.
All other fields can be filled in later.
After creating a problem, you will return to the «Problems (Writer)» tab. Your newly created problems will be there. By clicking on the name of the problem, you will go to the settings page.
In the problem settings page, you will see 9 tabs:
In the home tab (is denoted by a hut) you can change time and memory constraints, change problem name, choose sources and other. After writing the sources, you need to select them in this tab. The checker for the problem can be selected immediately.
In the tab «Contributors» you can add contributors to the problem. You can choose a contributor and assign him a role that he will perform during the preparation of this problem.
In the «Statements» tab, you can create statements in Ukrainian and English. Read more about creating statements in the «Statements» section.
In the «Resources» tab, you can add resources to the problem, for example, pictures to the statement.
In the «Sources» tab, you can create generators, validators, checkers, scorers, and solutions. You can read more about each type in the corresponding clause of the next section.
In the «Tests» tab, you can create manual tests, create tests using a generator, or add test archives. When creating tests, you need to specify their name, cost and the tests themselves (in the case of creating manual tests), or the parameters of the generator. If you want to make this test as sample, which will be displayed in the statement, you need to check the «sample» checkbox. Read more about creating a test generator in the generator section. Read more about the cost of tests in the «Scorer» section.
In the «Tags» tab, you can create tags to this problem.
In the «Result» tab, after submiting the problem, you can view the tests you created and the result of your solution.
In the «User solutions» tab, you can view all solutions of other users.
To the right of the tabs, there will be 2 buttons: «Update» and «Submit».
Stages of problem creation
Statement
The first step in creating a problem is to create a statement. The statement is a mandatory part of the problem. In the «Statement» tab, you will see three buttons: «Create», «Delete» and «Submit». To create a statement, click on the «Create» button.
The statement is a very important part of the problem, where you must clearly explain the essence of the problem. Statements on Algotester are written in the LaTeX data markup language. When creating a statement, you will see 6 tabs:
In the home tab (indicated by a hut) you can choose the language and change the name of the problem.
In the «Description» tab, you must describe the essence of the problem, tell what is given, explain what the user needs to do to solve it.
In the «Input» tab, you must describe what data the user will receive and in what order and format it is given.
In the «Output» tab, you should describe what response you expect from the user and in what format he should output it.
In the «Constraints» tab, you must give constraints on all incoming data. If in the statement you guaranteed some special constraints, for example, the absence of loops or multi-edges in the graph, they should be mentioned here as well.
In the «Notes» tab, you can explain the samples, write an important note that may not be obvious in the description, or specify details that will help the user understand what exactly he needs to do.
Follow our guidelines for writing terms and statements. After writing the statement, you have to wait until system will generate it. You can find examples of statements in the archive.
Solution
The next step is to write the solution to the problem. Problem solution is the source code that the system will compile and run on the test set, to check the answer with the answers of the participants. The problem should have one main solution. The solution must read the input data in the format described in the statement. You can specify the main solution for the problem on the home tab (indicated by a hut). We recommend that each problem also have other solutions written by testers to avoid mistakes in the main solution.
Algotester libraries
Read our article about Algotester library. You can find examples of its usage in this article in next sections.
Validator
The next mandatory component of the problem is the validator. A validator is a program that reads a single test and verifies that it conforms to the format and constraints specified in the statement. Use our library for writing validators for problems. Validator reads input data from the standard input stream (
STDIN
), and outputs to the standard output stream (STDOUT
). If it finds an incorrect test, it should output a short text explanation of an error and return 0. A test is considered correct, if validator did not output anything and returned 0. Validator must check not only constraints on the size of input data, array elements, but also graph connectivity, absence of loops in it, or any other guaranteed conditions and constraints. There must be one main validator in the problem. You need to specify the main validator for the problem in the home tab (indicated by a hut). Here are some examples of validators: validator for the A plus B problem, validator for the Marichka and cookies problem, validator for the Mykola, Vasyl and a maze problem.Checker
The last mandatory component for creating problems is the checker. Checker is a program that checks the correctness of the answer. If the answer to the problem is unambiguous, then
Token Checker
exists for this. If you need to check the answer in real numbers, useDouble Checker
with the precision you need. If there is no single answer to the problem, then you need to write a checker yourself. Use our library for writing checkers. Use the «initChecker» function. It returns an array of three elements: the test data reader, the user output reader, and the author solution output reader. If the user’s answer is incorrect, then the checker must output an error message toSTDOUT
and return 0. The answer is considered correct if the checker did not output anything and returned 0. The checker accepts 4 parameters: paths to files with input data, user output, author output, user code. There must be one main checker in the problem. You can specify the main checker for the problem in the home tab (indicated by a hut). Here are some examples of checkers: Token Checker, Double Checker 1e-4, checker for the Doubled Sum of Squares problem, checker for the Sweet Candies problem.Tests
At this stage, your problem already has all the mandatory components. You can go back to the home tab (indicated by a hut), select all the main sources for the problem and submit it. If you did everything correctly, the problem will receive the status «Ready».
Despite the fact that the problem is ready, there are no tests in it yet. Tests are sets of input data on which user solutions will be tested. There are three ways to add a test to a problem:
Create a manual test. A manual test is a test that is created manually. Such tests can be used as samples that will be displayed in the statement.
Write a test generator (more details in the next paragraph).
Add archived tests. To add archived tests, you need to send an archive in zip format, and specify the extension of the input and output files. All input and output files must have extensions that match the ones you specified. Files with input and output data that relate to the same test must have the same name.
Generator
The generator is a program that allows you to automate the test generation process. Use our library when writing generators for problems. Parameters can be passed to the generator, for example, the maximum size of the test or the constraints of the problem parameters. The first parameter (with index 1) is always the test number. You must specify the following parameters yourself. As the last parameter, you can add hash. This is a randomly generated string. It needs to be added so that it is not possible to recreate the tests even with the generator code. The pseudorandom number generator is initialized from all parameters. The generator must output the result to the standard output stream(
STDOUT
).Here are some examples of generators: generator for the A plus B problem, generator for the Marichka and cookies problem.
One problem can have several generators that generate different types of input data. Here is one example and another example generators for the Maksym, Petro and Bohdan problem. The first generator forms a random connected graph, and the second a star of a given size. Since these are 2 different types of graphs, more than 1 generator had to be used.
Submitting a problem
After writing all the main sources and adding tests, the problem has to be submitted. To submit a problem, click on the «Submit» button located to the right of the problem setting tabs. After submitting the problem, the following will happen:
Tests will be created. The generator will generate tests, and together with manual and archived tests, a set of tests will be formed.
The validator will check the tests for correctness.
The solution will run on a set of tests, and the author’s answers will be generated.
If an error occurs at any of these stages, the problem will receive the status Has Errors, and in the «Result» tab you will see what exactly went wrong. Otherwise, the problem will have a status of Ready. If the problem has the status Ready, then you will be able to see the tests in the «Result» tab.
Interactive checker
An interactive checker is a checker for interactive problems. Use the «initInteractiveChecker» function. It returns an array of three elements: a test data reader, a user input stream (you need to write input to this stream), and a user output reader (read the user’s responses from it). The generator and validator for interactive problems must generate and validate only the input data for the checker, but not the solutions to the problem. Problem solutions interact only with the interactive checker. Note that the interactive checker is responsible not only for checking the correctness of the solution, but also for providing the user with input. Here is an example of an interactive problem. Checker for the Interactive Number problem. Examples of a validator and a generator to it: validator for the problem and generator for the problem.
Scorers and cost of tests
If you also want to take into account partially correct solutions for the problem, then you can score points for them. Then the user will be able to score a certain part of the points for the problem, if he did not come up with a fast enough or absolutely correct solution. The easiest way to do this is to assign a certain value to each group of tests. The user will receive points for a group of tests only if his solution is correct for all tests from the group.
You can also get a certain number of points for a problem using scorer. Before receiving points for a solution, it is checked by a checker. The scorer scores only those solutions that have passed the checker. The scorer accepts 6 parameters, which are file paths:
Input file.
User output.
Author output.
Folder with processed code files (STDIN, STDOUT, STDERR files, user executable).
Folder for writing. This folder is for internal use by the scorer. It will be cleared between tests.
User code.
The scorer must output the non-negative number of points that the user will receive for the test to the standard output stream. Here is an example of a scorer: scorer for the Zenyk and sorting problem.
Tests execution logs
To see the result of the solution on one specific test, you need:
In the «Sources» tab, for the appropriate solution, click on «View», located in the rightmost «Actions» column.
Go to the «Result» tab and see the logs of the corresponding test.
Note that the very large tests in this tab are incomplete, but you can download the ZIP archive (in the upper right corner) with the complete tests.
Problem name
Follow common title capitalization rules when writing English problem names. Example: «The Best of the Problems» instead of «The best of the problems». This is not applicable to Ukrainian statements.
Avoid using any special characters in problem names (&\(^\wedge\)@* or similar).
Must not be too long (7 words or fewer).
Problem name must be unique in both English and Ukrainian (there should be no problem with the same name in the archive).
Limits
Default time limit: 2 s.
Default memory limit: 256 MB.
Time limit up to 7 s.
Memory limit up to 1024 MB, at least 128 MB, and must be a power of 2.
If time or memory limit is less than the default, make sure it’s well solvable in Java and Python.
Paragraphs
Separate paragraphs with an empty line in LaTeX; don’t use paragraph indentation or
\par
command.The statement must not be a single large paragraph. Split the statement into multiple logical paragraphs for readability purposes.
Variables
By default, all statement and input variables must be enclosed in
$
, for example:$n$
.Variables must not be bold.
It’s recommended to keep variable names single-letter and lower-case.
Use common variable names when available (e. g. \(n\) for the number of vertices, \(m\) for the number of edges, \(k\) or \(q\) for the number of requests).
Avoid indexing variable names (e. g. \(i\) or \(j\)) as input variables.
Literals
Literal numbers must not be enclosed in
$
. Example: Vertices are numbered from 1 to $n$, inclusive. Exception: if the statement requires outputting -1 when the answer does not exist, treat -1 as a literal string (see below).Literal strings must be enclosed in
\texttt{}
. For example, use\texttt{YES}
when describing positive output string.Do not use quotes for literal strings.
Numbering literals (or variables) must have a proper ending, e. g. the 2-nd, the $i$-th, etc. The same holds for the Ukrainian language
Array literals must not be enclosed in
$
, for example, [4, 7].
Formulas
All mathematical formulas must be enclosed in
$
, for example:$n < m$
.Don’t use * for multiplication. Use
\cdot
instead (e. g.$n \cdot m$
).Use
\times
for matrix dimension description, e. g. matrix of size$n \times m$
.Don’t use division sign /. Use fraction instead:
$ \frac{a}{b}$
.Use proper LaTeX commands as inequality signs:
\le
for ’less than or equal’,\ge
for ’greater than or equal’.Large formulas must be placed on a separate line and centered by enclosing in
$$
(double dollar-sign), for example:$$n < m$$
.Use
^
and_
for sup and sub, for example:$10^9$, $2^{nk}$, $a_i$
.Always use appropriate LaTeX commands when describing math symbols. Refer to this page for the full list of possible math commands.
Arrays (except literals) should be written as the following:
$[a_1, a_2, \ldots, a_n]$
.
Input
Always specify if the input token is an integer, float, string, or single character.
If the input contains floats, it must be clearly stated what format is expected.
Use the following style when describing input in English:
The first line of the input contains a pair of integers ..., The following $m$ lines describe..., etc
. Always use proper English articles.Do not leave input over-simplified, e. g. avoid
One integer $n$
. Instead, write:The first line of input contains one integer $n$ – number of bottles
.Each variable in the input must be briefly described.
Output
If it’s possible to have no answer, it should be clearly stated in the output section.
If there are multiple possible answers, it should be stated in the output section.
If it’s guaranteed that for the given input there’s always an answer, this should be stated in the output section.
If the answer contains float numbers, the output section must specify the allowed precision (absolute and/or relative).
If the answer has to be output modulo some number, it should be stated in the output section. It should be explicitly stated if the modulo number is prime.
Use the following style when describing output in English:
Print a single integer denoting the minimum number ...
etc. Always use proper English articles.Do not leave output over-simplified, e. g. avoid
Answer to the problem.
Instead, write:In one line print single integer n – number of bottles
.
Constraints
All constraints must be placed in the dedicated section of the statement. It’s allowed to copy constraints in the main statement section for emphasis purposes.
Combine constraints when appropriate:
$1 \le n, m \le 1000$
.Each constraint inequality must be placed in a separate line of the statement (hence separated by an empty line in LaTeX).
Length of a string must be denoted as |s|.
Use proper inequality signs (as described in the Formulas section).
Always try to make constraint numbers as readable as possible. For example, write
$1 \le n \le 2 \cdot 10^9$
instead of$1 \le n \le 2000000000$
.Use round or lucky numbers as constraints.
Each constraint line should end with a comma, the last one - with a dot. Any statement (except the first one) should start in a lower-case.
Lists
Use proper LaTeX commands for lists:
Unordered (bulletpoint) list: \begin{itemize} \item One entry in the list \item Another entry in the list \end{itemize} Ordered (numerated) list: \begin{enumerate} \item One entry in the list \item Another entry in the list \end{enumerate}
Images
All images must be uploaded in the Resources section of an Algotester problem.
Images are referenced by resource name without file extension.
Images must be centered by default, with the image description below:
\begin{center} \includegraphics[width=0.5\textwidth]{resource-name} \end{center}
Samples
A statement must contain at least one sample.
Avoid too trivial samples (aka Boiko samples).
The first sample must be the first test case of the problem. The same holds for the following samples, if any.
There is an opportunity to create samples only for statement.
Notes
The Notes section must contain sample descriptions when appropriate.
The Notes section can also contain additional definitions when needed, but they must also be referenced in the main statement.
Miscellaneous
Parts of the statement that need special emphasis (non-obvious constraints or conditions, corrected parts of the statements, etc.) must be bold (enclosed in
\textbf{}
).Use
---
in Ukrainian and--
in English, never use - as a long dash.Use spell-checker when writing English and Ukrainian statements.
The algotester.h and algotester_generator.h libraries are created to facilitate writing the source codes for the problems. You should use them when writing all validators, checkers, scorers, and test generators.
The algotester.h library
While using the library, you will work with the
AlgotesterReader
class. This is a class for reading data.
While reading, it can also validate various properties. This reader can
work in two modes: strict for validators and non-strict for checkers and
scorers. In strict mode, you have to check the data format with all
spaces and end-of-line characters. In a non-strict mode it is not
necessary to read spaces or end-of-line characters.
List of AlgotesterReader
class methods and their brief
description:
readChar
– reads a single character. You can pass a string of possible values, whether to skip whitespaces (not possible in strict mode) and the name of the variable being read. It returns the character that was read, or prints an error message to stdout and stops working. If the symbol can take arbitrary values, then an empty string should be passed as a list of possible values.readSpace
– reads one space character. You should use this in strict mode.readEndl
– reads one end-of-line character. You should use this in strict mode.readEof
– reads end of file character. It should always be used in the validator and checker after reading the user stream to make sure there is no redundant output.isEof
– checks if it is end of file. It takes a parameter whether to skip whitespaces (not possible in strict mode). If whitespaces are skipped, then result of this function is true if only whitespaces are left.readInt
– returns a 64-bit integer. It can take such parameters as minimal and maximal values and the name of the variable being read. For exampleint n = reader.readInt(2, 100000, "n");
reads variable \(n\), and checks if it is in range from 2 to \(10^5\).readVectorInt
– returns vector of 64-bit integers. It takes size of vector as a parameter. You can pass minimal and maximal values for each element and name of the variable. For eachvector<int> a = reader.readVectorInt(5, 1, 100, "a");
reads a vector with 5 elements between 1 and 100. In strict mode, all values must be space-separated and end with the end-of-line character, with no extra spaces.readUInt
– the same asreadInt
, but works with unsigned integers.readToken
– reads a string. It can take a variable name that is being read and regular expression. You can also pass minimal and maximal string length. Here are some examples:string s = reader.readToken(1, 1e5, "s", "(0|1)*");
– reads binary string (each character is 0 or 1), and checks if its length is between 1 and \(10^5\).string s = reader.readToken("s", "[a-z]+");
– reads a string and checks if every character is latin lowercase letter.If there are length constraints you should pass them as additional parameters, and not as a part of regular expression.
readLine
– reads a line until end-of-line symbol.readDouble
– reads a floating point number. Possible parameters: minimal value, maximal value, minimal number of digits after the decimal point, maximal number of digits after the decimal point, whether it can be read in exponent format or not and the name of the variable. Boundary comparisons are performed explicitly, so consider real-number error when passing bounds.
You can find more information about this methods here.
Another important functions of the library:
initValidator
– returns reader in strict mode. You have to use it for validators. It has no parameters.initChecker
– returns an array of three readers in non-strict mode: input stream reader, user output reader and author output reader. You have to use it for checkers. It takes the programs input parameters (int argc, char* argv[]).initInteractiveChecker
– returns a tuple of such elements: input stream reader, user input stream (you have to write answers in this stream) and user output reader. You have to use it for interactive checkers. It takes the programs input parameters (int argc, char* argv[]).initScorer
– returns an array of three readers in non-strict mode: input stream reader, user output reader and author output reader. You have to use it for scorers. It takes the programs input parameters (int argc, char* argv[]).isClose
– checks if 2 double values are close with given absolute and relative tolerance. It takes two double values, absolute and relative tolerance. Default tolerances are \(10^{-7}\).equalsIgnoreCase
– checks if strings are equal ignoring case.check
– takes a condition and a string (error message). If condition is false prints error message.
You can find examples of validators, checkers and other source codes here.
The algotester_generator.h library
This library is designed to facilitate the writing of generators for
problems. It contains AlgotesterGenerator
class. To work
with it, you need to initialize the generator with the
initGenerator
function. It takes the input parameters of
your program. You can initialize it in this way:
auto gen = initGenerator(argc, argv)
. When creating tests
with the generator, we recommend you to select «Append hash to
arguments» checkbox. After that, you can use methods to generate
different values.
List of AlgotesterGenerator
class methods and their
brief description:
randInt
– generate uniform random unsigned 64-bit integer. You can pass bounds to this method. If you pass one integer \(n\), it will generate integer in range \([0, n)\). If you pass two integers \(l\) and \(r\), it will generate integer in range \([l, r]\).randUInt
– the same asrandInt
, but generate unsigned integers.randDouble
– generate uniform random real number in range \([0, 1]\). If you pass one integer \(n\), it will generate integer in range \([0, n]\). If you pass two integers \(l\) and \(r\), it will generate integer in range \([l, r]\).shuffle
– random shuffles elements. It can take vector, or iterators to the begin and end.randomElement
– returns random element of vector.randLogUniform
– takes integer \(n\), returns random integer in range \([1, n]\), such that natural logarithm of that number is uniformly distributed. Useful in cases when you want to generate both small and large values.randBiasedInt
– takes boundaries and \(t\) as parameters. If you pass one integer \(n\), it will generate integer in range \([0, n]\). If you pass two integers \(l\) and \(r\), it will generate integer in range \([l, r]\). Generates \(|t| + 1\) numbers. If \(t = 0\), returns random number, if \(t < 0\), returns minimum of \(t+1\) uniform values, if \(t > 0\), returns maximum of \(t+1\) uniform values. Works in O(1).getArg
– takes index \(i\), returns \(i\)-th argument of input parameters.
Full description of all methods you can find here.