Any suggestions on how to improve this method? I am currently using it to select a single wallpaper from a directory of wallpapers
I know your not supposed to use arraylist anymore but i couldnt think of a altrnative
also im not sure how to filter for more than just one type of file (ie jpg gif png) in the directory info.
any suggestio...
Duplicate:
Random string that matches a regexp
No, it isn't. I'm looking for an easy and universal method, one that I could actually implement. That's far more difficult than randomly generating passwords.
I want to create an application that takes a regular expression, and shows 10 randomly generated strings that match that exp...
I already have a customer table, but from now on new records have to be assigned a unique random alphanumeric string of 5 characters in a new column. Is there anyways I can do this without having to use Trigger (on insert?)
...
I have a table of product. I have listed the items with pagination using rand() function. When using rand(), it displays the items in random order but the record is repeated while we go from 1 page to another page.
Is it possible to get non repeated items in each page using rand()? If yes how, if no what may be the option for this.
...
Hi!
I want to know if it's possible to grab random frames from a video and then "stick" these frames together to make a gif image?
I intend to achieve the above said idea by programming in Java.
What should I use? (I have no previous experience in programming involving videos, although am proficient in Java)
...
Hi,
Looking to make a really simple random number generator method in C. The numbers should be between 0 and 24 and can be for example 14.5f.
Any help would be great, thanks!
...
The iPhone makes it really simple to snarf down an image from the web; you can turn a URL into a UIImage in one line of code. So I'd like to enable my app (an educational puzzle game... my first!) to download some random images to make it more interesting and dynamic.
I thought about using Kodak's image of the day RSS feed, but I'm hav...
This is a very strange problem.
Here is my code:
//Function to get random number
public static int RandomNumber(int min, int max)
{
Random random = new Random();
return random.Next(min, max);
}
How I call it:
byte[] mac = new byte[6];
for (int x = 0; x < 6; ++x)
...
Hey Guys
I have a simple wrapper for an Mersenne twister random number generator. The purpose is to scale the number returned by the generator (between 0 and 1) to between argument defined limits (begin and end).
So my function is
inline float xlRandomFloat(float begin, float end) {return (begin+((end-begin)*genrand_real2()));}
I ...
i have written in matlab, a program, which is supossed to generate random numbers between 0 and 1. i have test it only with the runstest in matlab, and te result is that the sequence is random. i have seen the histograms too, and they have a beta distribution. i want to test this rng whith other test, such as diehard, ent, or nist, but i...
I'm familiar with the algorithm for reading a single random line from a file without reading the whole file into memory. I wonder if this technique can be extended to N random lines?
The use case is for a password generator which concatenates N random words pulled out of a dictionary file, one word per line (like /usr/share/dict/words)...
I've been trying to find a more pythonic way of generating random string in python that can scale as well. Typically, I see something similar to
''.join(random.choice(string.letters) for i in xrange(len))
It sucks if you want to generate long string.
I've been thinking about random.getrandombits for a while, and figuring out how to c...
Update: Please file this under bad ideas. You don't get anything for free in life and here is certainly proof. A simple idea gone bad. It is definitely something to learn from however.
Lazy programming challenge. If I pass a function that 50-50 returns true or false for the qsort's comparision function I think that I can effectively...
I have two files - prefix.txt and terms.txt both have about 100 lines. I'd like to write out a third file with the Cartesian product
http://en.wikipedia.org/wiki/Join_(SQL)#Cross_join
-about 10000 lines.
What is the best way to approach this in Python?
Secondly, is there a way to write the 10,000 lines to the third file in a rand...
I have a set of events that must occur randomly, but in a predefined frequency. i.e over a course of (totally) infinite events, event A should have occured 10% of the times, event B should have occured 3%, and so on... Of course the total sum of the percentages of the event list will add upto 100.
I want to achieve this programmaticall...
I need to create a block of unique lines to test a different project im working on.
so i created a simple program to generate a random string of X length.
The issue is that if i call it once i get a random string if i call it again (in a for loop for example I get the same string for the entire execution of the loop.
I have a feeling ...
I want to give users the ability to page through my blog posts in random order.
I can't implement it like this:
@posts = Post.paginate :page => params[:page], :order => 'RANDOM()'
since the :order parameter is called with every query, and therefore I risk repeating blog posts.
What's the best way to do this?
...
It'd be nice to be able, for some purposes, to bypass any sort of algorithmically generated random numbers in favor of natural input---say, dice rolls. Cryptographic key generation, for instance, strikes me as a situation where little enough random data is needed, and the requirement that the data be truly random is high enough, that thi...
a)In this case does the random number generator uses the system's clock (making the seed change) on each run?
b)Is the seed used to generate the pseudo-random values of expovariate(lambda)?
...
Whenever I use the rand function in C++:
#include<iostream>
#include<time.h>
#include<stdlib.h>
using namespace std;
int main(){
srand(time(0));
int n=(rand()%6)+1;
cout<<"The dice roll is "<<n<<"."<<endl;
}
I get a warning about conversion from time_t to int at line 5:
srand(time(0));
Is there any way to get rid of this warning?
...