Questions tagged [random]

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

Filter by
Sorted by
Tagged with
3
votes
2answers
54 views

Catch The Rabbit Game: How to Create Non-Repeating Randomization? (JavaScript, CSS, HTML)

I've designed this game, it's my first project. It's a spin-off from "The Pig Game" in a JavaScript course. I tweaked the HTML and CSS templates of the Pig Game for the UI, but I did the ...
2
votes
1answer
49 views

Pseudo-random number generator & password generator

I've started learning Rust and decided to implement something on my own from scratch. I've implemented a PRNG and I use it to generate random passwords. Project tree: ...
4
votes
1answer
83 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. ...
0
votes
0answers
34 views

A Tester of Paragraph Merger for Removing Overlapped Duplicated Lines in C#

This is a follow-up question for A Paragraph Merger with Removing Overlapped Duplicated Lines in C#. I am trying to implement a tester for testing the implemented paragraph merger for removing ...
2
votes
2answers
55 views

Random walk generator - looking for optimizations (Python)

I just started learning Python and this is the first code I wrote. It's a Random Walk generator. I think I got it to work pretty well but I'm also sure there are more effective and less clunky ways to ...
5
votes
1answer
52 views

Two player random number guessing game

I've created a two-player number guessing game in Haskell. My main objective was to practice dealing with "state" in a purely functional language (such as player scores, whose turn it is, ...
6
votes
3answers
539 views

Generate random string to match the goal string with minimum iteration and control statements

The following is my python code to find the number of iterations needed to generate random string iteratively to match the input string. Here I have repeated a similar kind of for loop in both the ...
7
votes
2answers
103 views

Method to randomise a string's case

I'm an amateur at programming and have created the following method with which I pass a lowercase string with the idea it is then returned either in it's original ...
1
vote
1answer
47 views

generating stochastic coloured noise for many oscillators

I have a system of n oscillators which oscillate with time. To each of these oscillators I am adding a fluctuating coloured noise term with a different seed for each oscillator. Here is my code for ...
9
votes
3answers
797 views

Applying random luck scores to instances of people

I'm trying to do a simulation on the role of luck in human achievement. Here is what I intend to do with my code: Create 20000 instances of people with randomly generated scores for skill, experience ...
2
votes
1answer
41 views

Generating random permutation with forced change of order (Secret Santa)

I wrote this function to generate random permutation of input vector, while making sure every element has switched place (for a Secret Santa like purpose). ...
3
votes
2answers
332 views

Generating binary sequences without repetition

I am trying to generate sequences containing only 0's and 1's. I have written the following code, and it works. ...
0
votes
1answer
68 views

Random Cave Generator Design Feedback

I am looking for feedback on my code's overall structure and design. I made a few concessions in reusability for the sake of not overcomplicating things (static/const public variables in the Game1 ...
7
votes
2answers
386 views

Using c++11 random header to generate random numbers

I'm new to programming. I have a question regarding the usage of c++11 random header to generate random numbers. I tried to learn it, but was unsuccessful. Recently, I've tried the following approach ...
4
votes
1answer
232 views

Math Random Addition

I am learning python from CS106. Please review my code for Khan Sole Academy, I think my code not efficient. Please add critique and advice for beginner like me. About Code Generate 2 random numbers ...
5
votes
1answer
98 views

Using Euler-Maruyama method to solve Ornstein-Uhlenbeck equation (SDE)

I am trying to implement the Euler–Maruyama method and use it to solve the Ornstein–Uhlenbeck process. I am basing my code on the wikipedia page where a python implementation is shown. More generally ...
1
vote
1answer
161 views

Coin Flip Streaks script

I am attempting to complete the coin flip streaks problem from automate the boring stuff with python. My code works fine but my only concern is the phrasing of the task. Does the question want us to ...
3
votes
2answers
81 views

Creating some Loaded Dice to make our board game fairer

Some friends and I were playing a board game and decided that the random dice rolls just weren't fair! So we came up with a scheme for making the rolls slightly more evenly distributed, and I ...
2
votes
2answers
170 views

Random game code id generator in typescript

Below is a simple typescript class used to generate a room code for an online lobby-based game (for example, https://jackbox.tv/ uses 4 digit codes to join rooms) The goal of the class is to quickly ...
5
votes
2answers
290 views

ASCII Random Walk Algorithm

I would like some advice on improving/optimizing a small program I wrote. What it does is run a random walk on a torus manifold with 8 colors that loop around. ...
4
votes
1answer
179 views

Displaying Media with HTML and JavaScript

I have a personal website that I use to share videos and images with friends. Below is a media generator using JavaScript and HTML. Its main purpose is to display one image at a time at the click of a ...
2
votes
1answer
72 views

Procedural generation of a general matrix representing a tile map

The problem is to design an structure which generates "uniformly" the next one in an initially zero matrix. Taking an arbitrary index i in the range [0,m-...
6
votes
2answers
97 views

My Guessing Game

This is a project that I remade to help me understand function definitions better. It may not be great but I am proud of it. I would love to have you review this project and tell me what I could ...
3
votes
2answers
63 views

speeding up matrix corruption

I need to randomly erase 33% of the non-zero elements in each line of a matrix. Side note: The end goal is to train a denoising autoencoder to remove this noise. My solution: ...
3
votes
2answers
261 views

Random alphanumeric string generator function (C, Windows, bcrypt.h)

The function uses the Windows "Cryptography API: Next Generation" (bcrypt.h)'s BCryptGenRandom function to generate ...
4
votes
1answer
170 views

Rock, Paper, Scissor - Game

This is my first ever created game. I been slowly but continuously learning PHP for the past 2 months and just last night I thought that I might be able to create a simple and very basic game. Due to ...
3
votes
1answer
80 views

Simple Password Generator Feedback

This is my first major project in F#, looking for any critique on how I can make it more standard or more concise. Some things I feel like I could have done better are the command flag parsing and the ...
4
votes
2answers
126 views

Mini guessing-game

I am a beginner programmer and I would like to improve in coding and develop my skills. That is why I am asking this question, what should I focus on improving in this code ? ...
1
vote
0answers
27 views

Randomly generating invoice IDs

As more fully detailed in my question here, I'm in the process of starting a small, local business and wanted to avoid showing sequential invoice IDs to clients, and instead generate completely random ...
1
vote
2answers
116 views

Python - Predicting the probability of 6 Heads or Tails in a row from a set sample size

I'm wondering whether there is a way to make this even more efficient or reduce the number of variables. ...
3
votes
0answers
71 views

Async generation of large buffers of random numbers on the GPU

I would like to obtain some feedback on a simple code I wrote to implement an easy and hopefully fast way to generate a large number of floats with CURAND and use them one at a time. This is achieved ...
3
votes
1answer
154 views

Test the hypothesis that the expected number of edges of a random connected graph is \$ O(n \log n) \$

Motivation The most common model for a random graph is the Erdős–Rényi model. However, it does not guarantee the connectedness of the graph. Instead, let's consider the following algorithm (in python-...
2
votes
0answers
48 views

Random generation java logic used in Nifi [closed]

I was just reviewing the source code of Nifi, see explanation and public version of the source. This got me wondering whether there are any obvious improvements here to increase the performance of the ...
0
votes
1answer
90 views

C++ Random Tree Node

I've been trying to kind of teach myself "Modern C++" the last couple of months and I just finished this interview type problem and thought it would be a good one to get some feedback on. I not ...
3
votes
2answers
427 views

Universally unique 64 bit long generator

I'm trying to make an ID generator that generates 64 bit longs. The IDs should be globally unique even between two offline machines. This is the same idea as UUID (GUID), but UUID is 128 bit long and ...
4
votes
2answers
192 views

Ising model simulation using metropolis algorithm

I am new to this community; I have tried my best to respect the policy of the community. I have written the Monte Carlo metropolis algorithm for the ising model. I want to optimize the code. I have ...
1
vote
3answers
68 views

high card game implementation

I wanted to write a simple implementation for a high card game. Basically two cards are drawn and the higher one wins. Additional rules: support for multiple decks, if same suits drawn then the ...
1
vote
1answer
79 views

Simulating a Rock, Paper, Scissors Game - Flexible

Today I learnt the basics of OOP. I have tried to apply them to this Rock-Paper-Scissors project. However I'm still a beginner, and so I feel my code can be improved. Are there any tips, trick or ...
4
votes
1answer
134 views

Simulated annealing for magic square-of-squares puzzle

I'm working on a function that takes in a NumPy array containing only mutually distinct positive square numbers. I want the function to pick an element at random, find if there is a lower positive ...
4
votes
1answer
101 views

Randomizing all class variables in constructor c++

I'm playing around with making random items and decided to implement the following structure. ...
4
votes
1answer
72 views

Random number generator utility class

I have implemented a utility class to perform various random number related task. I am looking for any feedback on design / implementation. I plan to expand the class, and so would like to correct any ...
3
votes
1answer
98 views

Von Neumann random bytes debiasing

I need to create a method to debias biased bytes from the method get_raw_bytes(length) using von Neumann debiasing method. Von ...
2
votes
1answer
105 views

Dice roller - python

I am about to graduate with my Associates degree in Math and will soon go for my bachelors. I've decided with two years of school left its best if I start learning to program. I am starting with ...
2
votes
1answer
78 views

Could anyone say if this is a reliable shuffling code?

I am trying to prove the famous "Monty Hall Paradox": The Monty Hall problem is a probability puzzle named after Monty Hall, the original host of the TV show Let’s Make a Deal. It’s a famous ...
6
votes
1answer
83 views

Dangers of increasing fishing on a fish population simulation

Setup The following code implements the algorithm described in this and this paper. The first paper describes how the evolution of a fish population can be simulated, while the second paper introdues ...
1
vote
2answers
69 views

Monte Carlo Simulation of “DNA Mutation” Game Mechanic

The game Space Station 13 (on the Paradise Station codebase) contains a DNA mechanic. Every carbon-based lifeform with DNA has 55 "blocks" that can be altered in a DNA Modifier, giving the mob ...
-2
votes
1answer
101 views

Python guessing game, lottery numbers but using def [closed]

So my task was to make a lottery function, but the instructor only provides half the code when explaining and going through my resources i was unable to find proper examples on how to complete it ...
0
votes
1answer
54 views

My first code - looking for feedback on best practices and things I should avoid doing in the future

After just learning a bit of Python I tried coding something myself. I attempted to do a game of Blackjack, which is far from perfect, and still doesn't have some rules a real game has (in my game an ...
7
votes
3answers
380 views

I made a guess the number game in Python

I just started programming a week ago. Online tutorials aren't my thing, so I decided to just start projects and learn what I need for the project. My first project is a guess the number game. The ...
4
votes
3answers
196 views

A dice roller in C

I am learning C and, for learning purposes, I implemented a dice roller. It uses arc4random(3) for random number generation, as I couldn't find something better. It works both interactively, if no ...

1
2 3 4 5
15