Thanks to visit codestin.com
Credit goes to github.com

Skip to content

pcannon09/randx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Randx library

Set random ints, floats, vectors and characters in C++! It's the easiest way!

Version

1.1.0

How to use it:


You need to add it to vendor / include directory and:

#include "dir/randx.hpp"

// Random integers:

auto variable1 = randx::randomInt(20, 80); // To set random integers with in a range of 20 - 80

std::cout << variable1 << "\n"; // It will print a number of a range of 20 - 80

// Random floats

auto variable2 = randx::randomFloat(1, 8); // It will set a random float of 1 - 8

// Random strings in vector list

std::vector<std::string> strVector1 = {"H", "E", "L", "L", "O", ",", "W", "O", "R", "D", "!"}; // Create an array

std::string inputVar = "";

std::cout<<"Type a word: ";
std::cin>>inputVar;

std::cout<<"Random string of variable that contains: '"<<inputVar<<"' is:\n";

std::cout<<randx::randomString(inputVar)<<"\n"; // Get random str

About

Set random ints, floats, an charecters in C++! Its the easiest way!

Resources

Stars

Watchers

Forks