Questions tagged [random]
This tag is for questions pertaining to random numbers, whether pseudo random or truly random.
812 questions
5
votes
1
answer
132
views
Simple random password generator in c#
A simple random password generator in C#. Looking for any improvements around speed or design. Any char[] can be passed to choose random chars from. The array I ...
2
votes
1
answer
131
views
Program to get all possible words from a set of letters
I wrote this code below to get all possible words for an array containing \$n\$ letters.
The logic of the code is that the letters of the array are mixed up in random positions and checks if this ...
4
votes
2
answers
240
views
Ruby Array#own_shuffle method
I have tried to implement the Array-shuffle method myself. Haven't had a look on some similar algorithm-examples by purpose and tried to figure out something myself.
The actual Array-extension:
...
7
votes
3
answers
568
views
Team picker command line application
I've made a program for randomly splitting game participants into different teams. The code works and solves the problem. I'm interested in advice on what you'd do differently or better.
...
5
votes
1
answer
145
views
backward induction algorithm computation
Is there a way to significantly speed-up this code?
I'm solving a dynamic programming model using a backward induction algorithm. A crucial step is to calculate the current-period value function (VF), ...
2
votes
1
answer
128
views
randi Template Function Implementation for Image in C++ (Rev.3)
This is a follow-up question for An Updated Multi-dimensional Image Data Structure with Variadic Template Functions in C++, rand Template Function Implementation for Image in C++, randi Template ...
5
votes
1
answer
289
views
randi Template Function Implementation for Image in C++ (Rev.2)
This is a follow-up question for An Updated Multi-dimensional Image Data Structure with Variadic Template Functions in C++, rand Template Function Implementation for Image in C++ and randi Template ...
6
votes
1
answer
257
views
randi 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++ and rand Template Function Implementation for Image in C++. I implemented <...
5
votes
6
answers
2k
views
Bubble sort with 10 random numbers
I want to make a bubble sorting algorithm of 10 random (non-repeating) numbers from 0-50. I changed many aspects of it while making it and finally got it to work, but I would like to see if there's ...
4
votes
3
answers
145
views
Number guessing game in Rust
I am learning Rust and would like a review to make sure I am following best Rust practices before continuing. The user enters a number between 1 and 100 up to 6 times to guess the randomly-generated ...
6
votes
1
answer
272
views
A PCG-based random number generator that is interchangeable with System.Random
I took the basic structure from this link and wrote the following class.
Can you review the code?
Can you find a silent bug?
...
6
votes
1
answer
369
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 ...
4
votes
1
answer
154
views
Generating random bytes
I implemented a simple function that generated random bytes Vec<u8> with given n size. Then I wondered how can I optimize ...
5
votes
1
answer
154
views
Cryptographically secure random int in range
I tried to make a cryptographically secure random int in range generator for javascript, practically the javascript equivalent of php's random_int(min,max):
...
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 ...