Tagged Questions
5
votes
1answer
45 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, ...
1
vote
2answers
89 views
How to make this random number game better?
I'm a newbie trying to teach myself Python. Could somebody tell me if there is a better way to write this? I am also curious as to whether or not there is anything I should not do. This code does ...
2
votes
2answers
43 views
Simple evolutionary string matching
This is based on a very similar question I asked, found here.
The intent of this program is to start with a set number of random strings of zeros and ones, and eventually evolve them to find one ...
5
votes
2answers
77 views
Change random list of numbers into all 5's using simple evolution simulation
This is supposed to be an evolutionary algorithmic program, and I'm not sure if it does what it's supposed to do.
It is supposed to take a random list of numbers (containing at least one 5), and over ...
5
votes
2answers
93 views
Python script for generating random C code
I'm writing a Python script to randomly generate C functions. This is my first time using classes in Python and I'm basically doing my best to pretend I'm using Java.
I'm looking for a review of my ...
7
votes
2answers
511 views
How random is this password-generating algorithm?
This code's sole purpose is to create a very random password, using letters and numbers.
I think that it fulfills its purpose, but I wonder, could it be done better? I'm not talking about ...
1
vote
2answers
178 views
Die-rolling for ordering
I have a little experience with Python and am trying to become more familiar with it. As an exercise, I've tried coding a program where the ordering of a list of players is determined by the roll of a ...
3
votes
2answers
150 views
Generating a random string of characters and symbols
After coding this, I was wondering if there are any ways in which I can improve upon it. It generates a random string of characters and symbols the same length as what is entered by the user. It uses ...
3
votes
1answer
81 views
7
votes
3answers
384 views
Better way to create a string of random characters
I'm generating domains with random names but I'm pretty new to Python. I used the map function because it packages the results into a list which I can then join() ...
9
votes
2answers
564 views
Dice-rolling simulator
I know there is a better way to store data. What is the most concise way to simplify this script?
...
9
votes
1answer
89 views
Produce bitcoin private key from 31 playing cards
I've written some Python code to generate a random hexadecimal string using 31 playing cards drawn without replacement (so no card appears more than once). This is sufficient to provide more than 160 ...
4
votes
2answers
573 views
Roll a die according to the number of sides that the user enters
I have created a program which rolls a die according to the number of sides that the user enters:
...
4
votes
1answer
245 views
2
votes
1answer
171 views
Opinions/Improvements on a run periodically/timer function in Python 2.7
I'm looking for some opinions on this bit of code that I wrote and if there are any ways it can be improved.
The scripts aim is to run the function runme() every 60 seconds with a random interval ...
6
votes
2answers
267 views
Generating random HTML color grid
This is a Python script that generates a grid of random HTML colors. It works by reading random data from /dev/urandom and then encoding it as a hexadecimal ...
3
votes
2answers
560 views
Generating random sequences while keeping sum fixed
The output is a random sequence, and the input is the sum of the sequence.
My solution is generating a random number *rand_num* from (0, sum_seq) at first, then draw another number randomly from (0, ...
1
vote
3answers
173 views
What is wrong with my Genetic Algorithm?
I am trying to understand how genetic algorithms work. As with everything, I learn by attempting to write something on my own;however, my knowledge is very limited and I am not sure if I am doing this ...
1
vote
1answer
330 views
randrename — insert random nums in filenames
I have an old mp3 player with a broken screen. Consequently, it's a real pain to turn shuffle mode on and off; however, there are a few albums that I wanted to mix together and have shuffled for when ...
1
vote
2answers
329 views
Random Topic Generator
I've written a python module that randomly generates a list of ideas that
can be used as the premises for furthur research. For instance, it would be useful in situations where a new thesis topic is ...
5
votes
1answer
1k views
Randomly sampling a population and keeping means: tidy up, generalize, document?
This is part from an answer to a Stack Overflow question. The OP needed a way to perform calculations on samples from a population, but was hitting memory errors due to keeping samples in memory.
...
10
votes
1answer
545 views
Quasi-random sequences: how to improve style and tests?
The requirements for this one were (original SO question):
Generate a random-ish sequence of items.
Sequence should have each item N times.
Sequence shouldn't have serial runs longer than a given ...