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

learn more… | top users | synonyms

2
votes
2answers
98 views

PHP secure random number generator

I just wrote this function and I was curious if anyone could find any flaws in it? It look pretty secure to me but I just want to make sure since I'm no cryptography expert. ...
3
votes
0answers
18 views

Random numbers, IO monad, and pure code

To get used to Haskell, I wrote a little program using the Diagrams package which generates 100 random dots (larger dots are more likely to be in the center). ...
1
vote
1answer
33 views

Random Distribution to fit an Average Python

This is from my own question on Stack Overflow. I want to get average numbers from a range such that they fit an intended average. I expect something bell-curve-like, but asymmetrical unless the ...
3
votes
1answer
51 views

Virtual Slots Implementation

What I can do to make this code more efficient? It is supposed to be like one of those slot machines where you gamble on it and stuff (like at a casino). ...
6
votes
2answers
89 views

Generating non-repeating random integers in a fixed range

I was working on the "Robot Name" exercise over on exercism.io (neat site, by the way), the gist of which is: Generate random, unique strings that match ...
3
votes
1answer
60 views

Generate a random integer of length N with unique digits

The task is simple: given N, generate a random integer with no repeating digits. ...
3
votes
1answer
50 views

Percentage based drop prize on Mob entity kill

I have created a simple percentage-based random prize drop for killing certain mobs. A drop is basically what the player will get in return for killing a mob, as a reward. So I have a large list of ...
4
votes
1answer
76 views

Simple math facts game

I've made a simple game for testing math facts (think practice for elementary school-age kids). It displays a random addition, subtraction, multiplication, or division problem, and feedback on if the ...
4
votes
2answers
452 views

Random Quote in java

Problem Statement: Create a class diagram and Java code for the following system and scenario, taking into account the possibility of future extensions. "The system is a command line utility ...
1
vote
1answer
46 views

Playing “craps” for the win v0.3

Continud from Playing “craps” for the win v0.2 You roll two dice. Each die has six faces, which contain one, two, three, four, five and six spots, respectively. After the dice have come to ...
1
vote
2answers
109 views

Playing “craps” for the win v0.2

Continued from Playing "craps" for the win You roll two dice. Each die has six faces, which contain one, two, three, four, five and six spots, respectively. After the dice have come ...
0
votes
2answers
61 views

“Random Quote Of The Day” program [closed]

Problem Statement: Create a class diagram and Java code for the following system and scenario, taking into account the possibility of future extensions. "The system is a command line utility ...
10
votes
2answers
355 views

Playing “craps” for the win

No specific question here. I am beginning with Java and here is an exercise. The rules of game: You roll two dice. Each die has six faces, which contain one, two, three, four, five and six ...
1
vote
1answer
102 views

Lottery number picker

This is my first Python project. Let me know how I did, and where I can improve it. ...
1
vote
0answers
83 views

Using basic methods to make a high/low game [closed]

This is my first big project with using methods. My prompt is to: Write a Java program that plays the dice game High-Low. In this game a player places a bet on whether the sum of two dice ...
8
votes
3answers
580 views

Randomized response generator for number-guessing game

I am currently learning C and playing around with the rand() and if/else statement. This ...
6
votes
3answers
983 views

Generating a not-the-same-as-last-time random number

I have to generate random number which differs from the number generated last time. Which of these two variants is better? Or maybe you can suggest better implementation. ...
8
votes
5answers
563 views

Probabilistic matchmaking simulation

The following is a problem I found on this wiki. What can I do to optimize my algorithm, and make this code more C++11? Write a program to discover the answer to this puzzle:"Let's say men and ...
19
votes
3answers
2k views

Proof that I was wrong about Random Number Generators

I wrote this code to show how wrong I was about Random Number Generators. Context: From Comments to this answer to Regularity in the "Rusty Towel of Mutual understanding" that isn't ...
1
vote
3answers
347 views

Pseudo-random generation able to regenerate backwards

Using the accepted answer from this question, I made a random number generator which can regenerate previous numbers in order. Ideone version ...
3
votes
1answer
86 views

Small pre-C++11 pseudo-random library

Some time ago (pre-C++11) I wrote a small random number generator library as part of a university assignment. The code has been stored on my hard drive for quite some time and today I dug it out and ...
5
votes
1answer
88 views

Software Key Generator

I have created a Java program which generates a key (for activating a piece of software for example) my code works correctly however there are parts of it that I know can be improved. In particular ...
3
votes
2answers
72 views

Write a function to extract a given number of randomly selected elements from a list

I'm going through the 99 Haskell problems and I have a few question about the solution I implemented for Problem 23. It asks: Extract a given number of randomly selected elements from a list. ...
3
votes
1answer
33 views

Input on where and how I can make improvements on my randomizer

As my title states I'm just looking for a little input on how I can improve one of my side projects when I'm not doing my CS assignments. All my program is, is a primitive randomizer for Battlefield 4 ...
6
votes
6answers
702 views

Prevent repetitive random numbers

Is this a good way to prevent repeating numbers, or is there a better a better, more efficient way of doing this? By efficient, I mean a less CPU and memory consuming process. I only mean two numbers ...
4
votes
1answer
52 views

Simulating the martingale betting system with roulette

I wrote a program that simulates many instances of trying the martingale betting system with roulette in Haskell. At the answerer's suggestion I opted to leave the ...
0
votes
2answers
164 views

Really basic terrain generator

This is my first attempt at writing a c++ program, so bear with me. I tried to use as many methods as I learned in about a week-long period. ...
35
votes
14answers
6k views

Generate random numbers without repetitions

I want to generate a list of N different random numbers: ...
10
votes
7answers
815 views

Too-high / too-low guessing game in Swing

I have created this program and it works fine. It's just that its too wonky and huge so I was wondering if anyone knew how I could shorten the program so I didn't have to put all of these into each ...
2
votes
2answers
65 views

Optimizing a particle filter weighted selection step

I have a vector with 10000 particles that I use in a Particle Filter. The problem is that it's taking too long to compute the weighted selection of the particles. I want to use a vector of weights ...
13
votes
4answers
836 views

Random name-picker with array

I created a program that picks a champion for a role on the game League of Legends using arrays and random numbers. Is there a quicker and more efficient way of doing this? There is one form that ...
2
votes
2answers
113 views

Change random methods without losing too much performance

I have a class in C# that uses a Random object to get a list of numbers randomized from an array of 1-25. Now what I need is improve this method to use ...
1
vote
1answer
27 views

Generating Passwords with a Secure PRNG

What's the best way to approach generating a password using a secure prng? In Python, I could simply use os.urandom. Any suggestions on this? ...
7
votes
4answers
1k views

Dice-rolling program

I am sort of new to programming. I would like to understand the code areas that are garbage and could be better written keeping the exact (if possible) behavior the code has now. ...
3
votes
1answer
113 views

Random Schedule Generator

In an attempt to try something new, and possibly help out at work, I tried creating a random schedule generator that generates schedules based on 3 inputs (Rotation length, Staff list, and Shift ...
6
votes
3answers
497 views

Shuffling function using rand()

I would like to hear your suggestions about my shuffling function in C++. I've decided to take advantage of using rand() to build a shuffling function. ...
6
votes
3answers
153 views

Cryptographic Random Number Generator function implementation

While surfing and through some experimentation, I have a new method to generate random numbers without using Randomize or Random ...
1
vote
1answer
54 views

Securely shuffling an array with 75 numbers in Go

I have a SHA512 hex string consisting of my random input and that of the user. Since rand.Seed only accepts a int64 I can never ...
16
votes
4answers
2k views

Generating 1000 random numbers

I have got the following C code and I feel it is crazy stupid and there must be a better way to do this, but just can't think of one and have yet to learn algorithms. ...
1
vote
2answers
75 views
5
votes
4answers
171 views

Checking if a random number exist within an interval efficiently

I have a problem where you have a bunch of probabilities associated with a number. In this case: any number between 0 - 0.3 should return 0, any number between 0.3 - 0.7 should return 1, any number ...
10
votes
2answers
79 views

Increase the performance of a random weighted 'tick' function

This is a very simple function, but it gets run on a roughly 10ms interval, so I'm looking for ways to improve it. The first obvious thing is that it has to run the comparisons nearly every time as it ...
6
votes
1answer
951 views

Generating random email addresses [closed]

The code below generates only 10 email domains. To me, this is bruteforce programming. Is there another random integer library? Could I use something like ...
13
votes
4answers
2k views

Simple random number generator

I have been wanting to learn programming for some time now and decided to really give it a shot today. I have edited and read lots of things in Java to fix small issues but never written from scratch. ...
5
votes
1answer
71 views

First text game with Python - Higher or Lower

Recently I have been learning Python programming, for about a week. I have covered all basic stuff - loops, strings, input masks - and have challenged myself by making a little game. It isn't much, ...
6
votes
3answers
122 views

Generate random 10% of file to be used in testing with Ruby

I'm new to Ruby, but not to programming. I just need a simple script that, given a text file, will pull out around 10% of the lines at random. Below is what I came up with based upon a Python script ...
4
votes
2answers
262 views

Pseudo-random number generator implementation check

I was searching for a pseudo-random number generator for C# and stumbled upon Tales from the CryptoRandom by Stephen Toub and Shawn Farkas, so I tried to implement a variation of their code. The main ...
4
votes
3answers
226 views

Random 6 to 10 digits number

I am generating a random numerical 6-10 digit password. I need some important reviews of yours. Is it OK or are there some needed modifications? ...
3
votes
1answer
26 views

Implementing `randoms`

Learn You a Haskell presents the randoms function. I implemented it as follows: ...
10
votes
1answer
116 views

Random Coin Toss in Haskell

Learn You a Haskell gives an exercise to implement the following function: ...