Tagged Questions
0
votes
0answers
22 views
How Can I Avoid Corners Touching When Generating Maze? [closed]
I have been trying to develop a maze generator in Python 3, and I am nearing completion.
I have it to the point where I can create the maze as seen in the picture below, however if you look closely, ...
-2
votes
0answers
24 views
CPU random instruction generator in python [closed]
Can any one tell if it is a good practice to write random instruction generator for CPU using python?
What are the advantages/disadvantages/expected difficulties etc...
0
votes
2answers
40 views
Function to generate radom alphanumeric cookies
I wrote this python function to generate random values to use as id for the cookies I have on my project.
These are some examples of what the return is:
...
3
votes
2answers
103 views
Counting consecutive streaks in random numbers
I heard that when you toss a die often enough, you could get the value "one" a million times in a row.
I am a beginner in Python 3 and I tried to write a little program that generates 1 or 2 randomly ...
1
vote
1answer
41 views
Discrete random number generator in Python
Description: I am given a list of possible values, each of which have an associated probability of occurrence.
How could I improve the algorithm that randomly generates a value based on the given ...
4
votes
1answer
51 views
Matching a randomly made colour using sliders
Below is a code which creates a random colour and shows it to the user in a 64 x 64 square. The user must then use the 3 sliders (R, G, B) to match the colour as closely as possible
...
1
vote
1answer
76 views
Simple Lottery Game
I have written a program in C that tests how many attempts it would need to win a lottery. Now I wanted to try out Python and I have written a little game based on the 6 out of 49 lottery game. I ...
6
votes
2answers
273 views
UEFA Champions League Draw Simulator
I'm new to Python and have written a UEFA Champions League draw simulator. It receives input for 32 teams from 14 countries, and then randomly distributes them into groups of 4, never putting two ...
5
votes
3answers
717 views
WV lottery tool in Python
I am self taught in python. I love to play the lottery and play with numbers. I put this program together as a hobby to learn python and build something that people can use.
I used and reused code ...
1
vote
1answer
72 views
7
votes
1answer
98 views
Python CS GO Case Simulator
I'm a beginner in Python, 1-2 months experience. Please assess my code. I used a dictionary to store cases. The cases_data is stored in another file. Is the structuring right? My code seems to have a ...
2
votes
1answer
133 views
Python - Faster random business date generation
I wrote a program that generates some synthetic data. Everything runs fine, but right now the program is so slow that I am only generating 1000 rows of data (and it still takes 3 or so minutes). ...
3
votes
2answers
113 views
A simple lotto game in Python
I have a simple task of creating a simple lotto game to practice python. I had some troubles with return of functions so i dropped few because of not understanding the scopes maybe.
In my next ...
5
votes
1answer
485 views
Choose random instants in a day with a low memory footprint
I'm looking for a way to plan a list of X events at the start of the day...
What I did before:
At 02:00 every day, choose X timestamps from "now" to 01:59 the next day.
That worked well but I had to ...
14
votes
3answers
465 views
My images have secrets A.K.A. the making of aesthetic passwords
This is my implementation of a prng steganography tool written in Python. You can also find the code on GitHub.
Steganography is the art of hiding messages in (images, videos or even audio)
I've ...
3
votes
2answers
122 views
Random Password Generator based on user input
This is my second program written in python. It basically creates a password made up of numbers, capital and lower case letters with the option to include special characters and dashes. I created a ...
3
votes
1answer
63 views
Palindromic game in Python
This is just a little palindromic game that searches all palindromic numbers in ur random generated list. Feel free to give me some advice.
...
4
votes
2answers
74 views
Generate a set of random values based on seed
I am a novice when it comes to Python. I am working stuff related to Flowshop scheduling and so to generate benchmarks I used one by Taillard (Link to his homepage). The details are in the technical ...
3
votes
2answers
76 views
Python - Random Number Guessing Game
I'm new to programming in general (Python is the first language I've tried learning) and I'm working my way through a collection of beginner's challenges. I'm having a little trouble wrapping my head ...
4
votes
1answer
36 views
Selecting random class from weighted class probability distribution
I have a solution that I've scratched out, but it's a tad messy:
First, let's say we have a random number from a uniform distribution we'll be using to select a random class from a class probability ...
6
votes
2answers
151 views
Pseudo Random Number Generator
I recently watched this video about the random number generation in Super Mario World. The technique that is used, as seen in the image below, multiplies one of the seeds by 5 and adds 1, the other ...
7
votes
1answer
398 views
Monty Hall simulation with any number of doors
After answering Monty hall python simulation I wondered what the outcome were to be if there were more than three doors, say four or seven. And so I decided to modify the problem slightly to adjust ...
1
vote
1answer
165 views
Infinite monkey theorem demonstration in Python
This was the assignment:
Here’s a self check that really covers everything so far. You may have
heard of the infinite monkey theorem? The theorem states that a monkey
hitting keys at random on ...
5
votes
3answers
343 views
Monty hall python simulation
I have the following code that simulates the monty hall problem (see google for more details). I used sets to do it but is there a more intuitive or efficient way to do it?
...
0
votes
1answer
70 views
Simulated arcade with a slot machine and number-guessing game
I am creating an arcade type thing in Python. Could someone suggest ways to simplify this code, or any other tips? All help is much appreciated.
I think the ...
7
votes
1answer
71 views
NCAA Pool - Generate random teams for a list of players
Anyways, I am running a pool where 64 entrants will receive a random team from a field of 64 teams. I'd like for it to be randomized to a decent extent, and although I understand the limitations of ...
7
votes
2answers
1k views
Python 3.4 password generator
I'm pretty new to Python and I made a password generator. I would like you to check it out and give me tips on how I could do it better.
...
3
votes
2answers
113 views
Sampling words from randomly chosen text files
I've developed a script to randomly select 50 elements from a list of .txt files. This process is repeated 100 times. The script joins the randomly selected text files to one long string and then ...
4
votes
1answer
296 views
Python name generator
This is a basic name generator I just wrote and want some feedback.
It basically chooses between a vowel or a consonant and appends it to a string. Note that it never puts two vowels or two consonants ...
5
votes
1answer
139 views
Random MP3 Selector and Player
So, I am either a glutton for punishment, or I have no life, but I wrote a script to answer a question over on Ask Ubuntu as a solution for selecting a random MP3 file in a given directory, and ...
5
votes
3answers
948 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 ...
4
votes
2answers
303 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
5k 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
107 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 ...
4
votes
2answers
196 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
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
94 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
1answer
74 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
2k 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
111 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 ...
4
votes
2answers
113 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 ...
6
votes
1answer
167 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 ...
0
votes
1answer
143 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
128 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 ...
2
votes
2answers
247 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).
...
3
votes
1answer
83 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 ...
2
votes
2answers
105 views
Basic 3 Round Card Game
Feel free to critique my code and offer suggestions on how to clean it up and make it more presentable. I have been working on this for a few days, and learning as I go.
...
2
votes
1answer
105 views
Generate a random discrete signal
I currently have this code to generate a discrete signal with random amplitudes, but a fixed frequency:
...
8
votes
1answer
167 views
Monty Hall Optimization in Python 3.5
This is for homework but the deadline is over and I know the implementation is correct because it concurs with the math. At this point I just want to check my implementation for potential ...
2
votes
1answer
112 views
Simple Random TicTacToe Generator
I just finished building a simple random Tic Tac Toe generator. The program will display 3 rows of a random numbers 0-1 and will print a message when 3 of the same numbers align. The program works ...