Skip to main content

Questions tagged [random]

This tag is for questions pertaining to random numbers, whether pseudo random or truly random.

5 votes
1 answer
167 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 ...
Short Int's user avatar
  • 761
2 votes
1 answer
141 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 ...
John's user avatar
  • 59
4 votes
2 answers
248 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: ...
michael.zech's user avatar
  • 5,044
7 votes
3 answers
576 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. ...
tomi bell's user avatar
5 votes
1 answer
149 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), ...
manifold's user avatar
  • 151
2 votes
1 answer
138 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 ...
JimmyHu's user avatar
  • 7,535
5 votes
1 answer
298 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 ...
JimmyHu's user avatar
  • 7,535
6 votes
1 answer
265 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 <...
JimmyHu's user avatar
  • 7,535
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 ...
asuno__'s user avatar
  • 61
4 votes
3 answers
154 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 ...
Hosch250's user avatar
6 votes
1 answer
276 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? ...
user366312's user avatar
6 votes
1 answer
378 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 ...
JimmyHu's user avatar
  • 7,535
4 votes
1 answer
159 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 ...
marknikky's user avatar
5 votes
1 answer
161 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): ...
hanshenrik's user avatar
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 ...

15 30 50 per page
1
2 3 4 5
55