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

learn more… | top users | synonyms

0
votes
0answers
32 views

Java Random number generator Excluding values in an array [on hold]

My problem is that I have a random number generator method in which I would want to generate random numbers excluding numbers stored in an array/ArrayList. For ...
1
vote
2answers
26 views

Generate new latitude and longitude in decimal

I have created simple algorithm to generate the new Location from given latitude and longitude. ...
-3
votes
0answers
13 views

Randomly arranging values in VBA 6.0 [on hold]

With regart to this question I'm triying to generate an algorithm to achive to change values' position randomly. this is my code: ...
3
votes
1answer
129 views

Generate random and unique array of int values for a given size

I need to generate an array of int values for a given size, the values should be random and unique. the following implementation is "ok" for small values [1,10k], I ...
4
votes
0answers
50 views

JavaScript constructor function “RandomNumbers”

My idea is to have objects which contain random numbers. The random numbers are keeped in some data structure (within the objects). Furthermore the objects shall have methods for working with the ...
7
votes
2answers
82 views

Generating bounded & unique random numbers in the Linux kernel

I recently needed to generate a series of unique random numbers (non-repeated) within a bounded range inside of the Linux kernel. The code I came up with is below. I'd appreciate any feedback -- again,...
2
votes
0answers
56 views

KS-Statistic in C++

Consider the MCG with parameters: a = 23, M = 10^8 + 1, and let the seed be 47594118. (This is the original MCG proposed by Lehmer in 1948.) Apply the Kolmogorov-Smirnov test to the first 1000 random ...
4
votes
3answers
783 views

Python election challenge

Basically, there is an election on 3 regions where either candidate needs to win 2 in order to win the election. Idea is to simulate 10000 elections to see which candidate wins. I think my solution ...
0
votes
1answer
44 views

Random Number Generator from user touch input

I have this in place for an RSA Key generation class. I force the user to swipe on the screen randomly and use that as a entropy pool. ...
8
votes
2answers
74 views

Robust, know-entropy password generator

My use case is I want a password generator that generates memorable and robust passwords for users, to give me a known minimum entropy. For this - I'm approximating set of Consonant-Vowel-Consonant ...
2
votes
1answer
46 views

Compression unit test data “easy case”

In another post I created a piece of data, which make compressor annoyed. Create 'worst case test' data for compression test Now I am trying to make it happy. I generate another data set, ...
2
votes
1answer
54 views

Display four random entries from an array

This code will take the array shown and display 4 random entries in the format shown (or near enough). Any part of this that can be optimised? I'm not happy about the ...
3
votes
2answers
56 views

Custom UUID based on time

I've been using random UUIDs—from Rust, e.g. Uuid::new_v4()—for my primary keys in a MySQL database. I recently happened across this, which suggests ...
10
votes
4answers
820 views

Random string of variable length generator

Below is my code for generating a random string of random length. I am using it in integration tests. Currently I have almost 2000 tests running each time a commit is made to master and a few of those ...
4
votes
2answers
80 views

Password generator in Django

I am a system admin, not a developer, so this might be pretty horrible code. This is a password generator. The point of the attempt was to become more familiar with Django at a lower level. I current ...
2
votes
2answers
190 views

Random password cracker using brute force

I created a fun password cracker using literal brute force, searching each character to see if it matches an ASCII character ...
5
votes
1answer
84 views

Random string generating function

Both these functions take in a sentence and generate a random string based of the length of sentence. Mine, the first one, runs 4 times more slowly than the second ...
2
votes
0answers
29 views

Multithreaded Monte Carlo pi approximation with own pseudorandom number generator - follow up

This is a follow up of the question I posted previously here. I made some changes, based in the answer by MikeMB, making use of asynchronous calls (with std::async ...
1
vote
2answers
120 views

Beginnings of a Scattergories program

I wrote this program as a start towards implementing the game Scattergories. I had a problem with the _sleep command so I used ...
3
votes
1answer
51 views

Multithreaded Monte Carlo pi approximation with own pseudorandom number generator

I made a Monte Carlo pi approximation program, that makes use of multithreading and a pseudorandom number generator I wrote (the one from big_wheel.hpp, which I ...
0
votes
2answers
68 views

Making a semi-random order of an array, based on a string

I made code to shuffle an array in a semi-random way. That is, it has to be random based on a string, but for the same string, it should return the same order. Is there a better way of doing it? <...
4
votes
2answers
175 views

Randomly generate a list with predetermined mean

Aim: randomly generate \$n\$ numbers between \$a\$ and \$b\$ with (roughly) mean \$m\$. Problem: The simple beginner's code I wrote becomes very inefficient as \$m\$ moves away from \$\frac{a + b}{2}\...
3
votes
0answers
20 views

Closest points using Rabin randomizing approach

I was told to use the following Rabin algorithm to find the shortest distance between 2 points in 2D: Randomly choose sqrt(n) and brute force to find the closest ...
3
votes
3answers
75 views

Simple random string generator in C

It is just a simple piece of C code that generates random lenght random HEX srings. Any ideas how this code can be improved? ...
1
vote
2answers
50 views

Find unique range numbers

im using the following code which is working. The code provide range of random values but unique one i.e. it doesn't return the same values until the full range was provided ,what do you think and ...
7
votes
1answer
284 views

C++ Quiz game w/questions in random order

This is a 10 question quiz that assess's the user's knowledge of the C++ programming language. Upon the start of the program some ASCII welcome art prints. The questions, answers, and correct answer ...
3
votes
1answer
45 views

Random timestamp within last 3 relative years

I'm trying to generate a random time between now and 3 years ago. To my knowledge, Go doesn't have a random(min,max) feature in either ...
3
votes
1answer
49 views

Random assignment function with caveat

Assign equal number chores to each person (assertion made elsewhere to ensure chores % number of people == 0) with the stipulation that each chore must not be one which the person was assigned the ...
4
votes
2answers
73 views

Only using randint, create a random list of unique numbers

There are many sorting algorithms, so how about unsorting algorithms? But how could one go about creating a random list of unique elements while not using shuffle, NumPy or any other ready made tools ...
3
votes
0answers
57 views

Distribute stats randomly

I have returned to programming after a year without practice and this is also my first time using Java. I know there is a more efficient way to do this so any suggestions would be appreciated. I am ...
3
votes
1answer
34 views

Filling random values in two sheets from a single sheet via Excel VBA

I fill out random values in two sheets (Testfall-Input_Vorschlag) and (Testfall-Input_Antrag) out of another sheet (ADMIN_ARB11). I have 371 rows in sheet (Testfall-Input_Vorschlag) and I have 488 ...
4
votes
3answers
121 views

Generating 50 Random Shapes

I am a beginner Java programmer. I have just finished up an assignment and would appreciate some advice and/or constructive criticism on my program. For context, I have the assignment details, ...
6
votes
0answers
52 views

Downloading HTML from random websites

I've never written a single line of Python before this program was made and all my "knowledge" of the syntax is from Enki ( an app ). I just wanted to download the HTML code from random websites and ...
3
votes
1answer
43 views

Multiplication Exercise Generator

I'm new to programming in Python, and I am trying to create a multiplication exercise generator. I've got the following code for the solution, but I'm wondering if there is any more elegant solutions ...
10
votes
2answers
1k views

Rock, Paper, Scissors - Python game

This is my attempt at making a 'rock, paper, scissors' game in python. The game takes the user's input and the computer's random selection and calculates who has won. All feedback appreciated. ...
1
vote
1answer
79 views

Random number guessing game in python

I just started learning Python this week and put this together for my first program (outside of a Hello World one). Does anyone have any feedback/suggestions for improvement for this? I've tried to ...
10
votes
4answers
1k views

Picking 10 distinct words 'randomly' from List of unique words

My goal is to pick 10 unique words randomly from a List containing 20 unique words. I would remove the duplicate word from the List whenever a duplicate word is ...
4
votes
2answers
80 views

Random playlist builder is slow

I wrote a Python script to scan my music library, randomly select 50 songs, and play them in VLC media player. It works great, just a little slow (takes several seconds to launch). I know that ...
4
votes
2answers
171 views

Unique random number generation in Swift

In the process of learning Swift, I'm building a lotto numbers generator that generates a random number and appends it into an array, if the number already exists then it should re-generate a random ...
4
votes
3answers
531 views

Testing a Random number generator

Firstly, would appreciate some code-review feedback, from a TDD and design perspective. Secondly, what are your thoughts on implementing test case: ...
4
votes
3answers
150 views

Guess three random numbers in order

We were given a homework assignment to create a C++ program that generates 3 different random numbers each time and the user is supposed to guess the three of them AND in order. I already achieved ...
6
votes
1answer
155 views

How random can you get?

I work for a service desk and change A LOT of passwords. Most the time the end user is a complete fool that doesn't understand the requirements for the password they want to use. So I created a ...
8
votes
1answer
189 views

Approximating Pi, Monte Carlo integration

I wrote some code that uses Monte Carlo Integration to Approximate pi in Java and Akka. The tl;dr explanation is you can imagine throwing darts at a square with a circle inscribed inside of it. You ...
2
votes
1answer
48 views

Get better conclusions from a javascript randomizer

I have a simple javascript randomizer that compares two random numbers with values 1 to 6. I want to get a good estimate about the probability of the first been greater than the second. I could do it ...
0
votes
1answer
115 views

Guessing a random number [closed]

The program asks for a user to set the max number of the range. That number is used to set the max range of a randomly generated number. The program keeps track of the number of guesses. I have taken ...
1
vote
1answer
82 views

Playing the game of Chaos

According to Rosetta Code: The Chaos Game is a method of generating the attractor of an iterated function system (IFS). One of the best-known and simplest examples creates a fractal, using a ...
3
votes
1answer
138 views

Generating a random coordinate (x, y) inside of a given polygon/area

I'm creating a virtual mapping software that essentially breaks coordinates into Areas. An Area is comprised of a defined list of boundary coordinates (coordinates ...
2
votes
2answers
101 views

Printing random lines from a file in Python

Is this the most efficient solution or can the performance be improved? Just opens a file and prints random words (lines with newlines stripped out). ...
1
vote
0answers
61 views

How do I generate a list of n numbers of random combinations in Python? [closed]

How can I alter this code to produce n numbers of random combinations instead of all combinations? ...
3
votes
1answer
55 views

Infinite Monkey Theorem Python Comparison

I wrote code to demonstrate the Infinite Monkey Theorem which states that if a monkey types at a keyboard for an infinite amount of time it will almost surely type a given text such as William ...