random-generator

Generating (pseudo)random alpha-numeric strings

How can I generate a (pseudo)random alpha-numeric string, something like: 'd79jd8c' in PHP? ...

Generating Random Passwords

When a user on our site looses his password and heads off to the Lost Password page we need to give him a new temporary password. I don't really mind how random this is, or if it matches all the "needed" strong password rules, all I want to do is give them a password that they can change later. The application is a Web application writt...

How many random elements before MD5 produces collisions?

I've got an image library on Amazon S3. For each image, I md5 the source URL on my server plus a timestamp to get a unique filename. Since S3 can't have subdirectories, I need to store all of these images in a single flat folder. Do I need to worry about collisions in the MD5 hash value that gets produced? Bonus: How many files could I...

Random string that matches a regexp

How would you go about creating a random alpha-numeric string that matches a certain regular expression? This is specifically for creating initial passwords that fulfill regular password requirements. ...

Any caveats to generating unique filenames for random images by running MD5 over the image contents?

I want to generate unique filenames per image so I'm using MD5 to make filenames.Since two of the same image could come from different locations, I'd like to actually base the hash on the image contents. What caveats does this present? (doing this with PHP5 for what it's worth) ...

Vb6 How do I make a Random String of 0-9 and a-z of x characters

Trying to create a random string, x characters in length using 0-9 and a-z/A-Z and can't seem to find a good example, any ideas? ...

SecureRandom: init once or every time it is needed?

Our team is using a SecureRandom to generate a list of key pairs (the SecureRandom is passed to a KeyPairGenerator). We cannot agree on which of the following two options to use: Create a new instance every time we need to generate a key pair Initialize a static instance and use it for all key pairs Which approach is generally bette...

Java: generating random number in a range

Hello, I am trying to generate a random number with Java, but random in a specific range. For example, my range is 5-10, meaning that 5 is the smallest possible value the random number can take, and 10 is the biggest. Any other number in between these numbers is possible to be a value, too. In Java, there is a function random() in the...

Generating random text strings of a given pattern

I need to generate random text strings of a particular format. Would like some ideas so that I can code it up in Python. The format is <8 digit number><15 character string>. ...

True random generation in Java

I was reading the Math.random() javadoc and saw that random is only psuedorandom. Is there a library (specifically java) that generates random numbers according to random variables like environmental temperature, CPU temperature/voltage, or anything like that? ...

How random is System.Random in .net 3 ?

I am currently writing a simple password generator (C#). For that I need some random Numbers. Is it OK to simply use the Random Class that ships with .NET or are there any known problems with that? ...

A random number generator that can get different numbers in < a second

I'm in need of a C++ (pseudo, i don't care) random number generator that can get me different numbers every time I call the function. This could be simply the way I seed it, maybe there's a better method, but every random generator I've got doesn't generate a new number every time it's called. I've got a need to get several random number...

VB6: List available commands, then execute a random one of them

Hallo! I'm a n00b, and I'm looking for a few lines of code in VB6 to implement this: I want to list a certain number of commands to execute, then tell my program to chose a random one among them and execute it: strictly speaking, I'm dealing with a MSAgent character, and I want him to make a face every 5 minutes. How can I achieve this, ...

C++. Is it possible that a RNG gives different random variable in two different machines using the same seed?

Hi everybody, I have this long and complex source code that uses a RNG with a fix seed. This code is a simulator and the parameters of this simulator are the random values given by this RNG. When I execute the code in the same machine, no matter how many attempts I do the output is the same. But when I execute this code on two differe...

Generate a random date between two other dates.

How would I generate a random date that has to be between two other given dates? The functions signature should something like this- randomDate("1/1/2008 1:30 PM", "1/1/2009 4:50 AM", 0.34) ^ ^ ^ date generated has date generated has random number to be after th...

What is the best way to generate a random key within PHP?

I'm looking to create a reusable function that will generate a random key with printable ACSII characters of choosen length (anywhere from 2 to 1000+). I'm thinking printable ASCII characters would be 33-126. They key does not need to completely unique, just unique if generated at the exact same millisecond (so uniqid() won't work). I'm...

generate random values for unit testing Hast table data type

My project generates few values(equal partitioning method) for each data types by getting the Minimum and Maximum values. i am doing this generating values for functional testing ,i am actually passing this values to nunit partner ,max amd min are applicable to int ,float ,double etc ..these values are test data . Initially i generat...

AFTER INSERT Trigger for SQL Server to create unique random 8 character code?

I started with some stored procedure code by Raymond Lewallen for a password generator. I would like to create a trigger that will create a unique 8 character ID each time a new row (a customer) is inserted. What I have so far: CREATE procedure dbo.AllAccessIDgenerator (
   @showID varchar(40) @accessID varchar(100) O...

I need a Python Function that will output a random string of 4 different characters when given the desired probabilites of the characters.

For example, The function could be something like def RandABCD(n, .25, .34, .25, .25): Where n is the length of the string to be generated and the following numbers are the desired probabilities of A, B, C, D. I would imagine this is quite simple, however i am having trouble creating a working program. Any help would be greatly appre...

Is using a GUID a valid way to generate a random string of characters and numbers?

Possible Duplicate: How Random is System.Guid.NewGuid()? Based on this question I would like to know if using a GUID to generate a random string of characters and numbers has any flaws in it? So, for example, if I wanted a random string of characters and numbers of 32 or fewer characters I could use the following C# code: stri...