Questions tagged [random]
This tag is for questions pertaining to random numbers, whether pseudo random or truly random.
80 questions
6
votes
1
answer
383
views
rand Template Function Implementation for Image in C++
This is a follow-up question for An Updated Multi-dimensional Image Data Structure with Variadic Template Functions in C++. I am trying to mimic Matlab's rand function into TinyDIP library.
The ...
8
votes
4
answers
17k
views
Random walk on a 2D grid
The program assignment:
A drunkard in a grid of streets randomly picks one of four directions
and stumbles to the next intersection, then again randomly picks one
of four directions, and so on. ...
58
votes
4
answers
36k
views
Seed std::mt19937 from std::random_device
Many people seed their Mersenne Twister engines like this:
std::mt19937 rng(std::random_device{}());
However, this only provides a single ...
110
votes
16
answers
244k
views
Generate random numbers without repetitions
I want to generate a list of N different random numbers:
...
12
votes
3
answers
6k
views
WinForms dice roller
I am writing a dice roller winforms application using C# 2012 VS. Dice roller is set up for playing Shadowrun tabletop. I feel that there might be too much code going into the GUI, but I am unsure ...
18
votes
2
answers
1k
views
Typical password generator in Python
Password generators are extremely popular on CodeReview with beginners to both coding in general and Python in particular, for a number of reasons:
They're (seemingly) easy to implement
They offer an ...
9
votes
1
answer
3k
views
Generate a random numbers class
I have made class to setup a random number bases on <random>. It works fine, but I have doubt in ...
7
votes
3
answers
3k
views
Random number generation in Dice class
I don't intend on implementing this into an application yet as I'm going to test it first. As such, it doesn't do much beyond rolling. It also overloads some "typical" operators such as ...
6
votes
2
answers
199
views
A Simple Cluster Generator v0.2
[NOTE] This question can be depreciated in favor of version 0.3.
This is a code revision of a previous post and works well.
Code has been reworked to be far more clear and concise, thanks to ...
11
votes
3
answers
12k
views
Random number generation seeding in C++
I wrote a small function to return a random in a given range:
...
9
votes
3
answers
554
views
Generators and Distributions 2.0
In my original question: Generically encapsulating random generators and distributions into a class template I was given some excellent suggestions from two very informative users. I will give a basic ...
6
votes
1
answer
738
views
Shuffling an arbitrary list or sequence
After reading this question I wanted to write a short example of how a list or sequence could be shuffled in .net. The result turned out to not be very short:
Program.cs
...
4
votes
1
answer
175
views
Library for generating passwords
I am going to make this code below into the second release of my library, but I want to make sure I haven't missed anything. If there are improvements that can be made, I'd like to implement them.
...
3
votes
1
answer
830
views
Generating realistic terrain data
I have some fascination with terrain generators, so I whipped up this generator in Python. The way it works is pretty simple, but I figure that I should give an explanation for those who don't want to ...
3
votes
1
answer
179
views
A Simple Cluster Generator v0.3
[NOTE] This question can be depreciated in favor of version 0.31.
This is a code revision of a previous post and works well.
The purpose of this code is to produce a universe of points, randomly ...