random

mysql order by query, trying to randomize results by pairs of char_length

Hi all, I'm working on displaying a page of classifieds in table rows. The problem I'm trying to solve is to arrange the ads in such a way that reduces the amount of white-space on the page, while maintaining a random order. A diagram of what a couple of unordered ads look like: _______________ __________________ ad text here. | an...

randomizing large dataset

I am trying to find a way to get a random selection from a large dataset. We expect the set to grow to ~500K records, so it is important to find a way that keeps performing well while the set grows. I tried a technique from: http://forums.mysql.com/read.php?24,163940,262235#msg-262235 But it's not exactly random and it doesn't play w...

how in python to generate a random list of fixed length of values from given range?

How to generate a random (but unique and sorted) list of a fixed given length out of numbers of a given range in python? Something like that: >>>> list_length = 4 >>>> values_range = [1,30] >>>> random_list(list_length,values_range) [1,6,17,29] >>>> random_list(list_length,values_range) [5,6,22,24] >>>> random_list(3,[0,11]) [0,7,...

Sql Server 2005: Today's random records

I can easily get a random record with this: SELECT * FROM MyTable ORDER BY NewId() I can easily get a record with "today's date" with this: SELECT * FROM MyTable WHERE MyDate = "2010-24-08" -- db doesn't store times But how would I combind the two? Get 1 random record... anything with today's date. If none are found...

While loop in JavaScript

I have the following JavaScript to get a random image from a list of available images: <script type="text/javascript">// <![CDATA[ var image = new Array(); var link = new Array(); image[0] = 'http://www.ovlu.li/ornitholog/cms/images/gallery/schwalbenhaus/schwalbenhaus01_small.png'; image[1] = 'http://www.ovlu.li/ornitholog/cms/images/...

Java random selection of lines in csv file for output

I want to read in a variable length csv file and randomly select a percentage of lines from the file to be output. For instance if I have 20 lines I would read each line in counting up to 20 the last line will have a number only (the percentage). then figure this percentage from the number of lines read in for instance 10 on the last lin...

ActionScript 3 - randomly coloured background - problem.

Hello. I use StackOverflow for the first time, so please be friendly and understanding. Few days ago I got interested in ActionScript. I have downloaded FlashDevelop (a free IDE) and FlexSDK4. Then I have learned the basics from some tutorials. For now I am not really developing any big project, I'm rather just doing tests. Anyway, a sol...

Generating random string in command prompt

I want to be able to generate random strings from the windows command prompt. This is so that i can create a temp file with that random name so that i am sure that the temp file absolutely does not exist. Is this possible? ...

How to generate a unique text id for a online resource

Hi, I want to generate a unique id which will be used in URLs to identify a specific resource. In principle it is the same as pastebin.com etc. does. The id and resource is not very secret but I want it to be so you just can't decrement a id and then get another users resource. I´m thinking of a CHAR(8) which will look nice in a URL an...

Conversion of non-uniform distribution to uniform distribution.

how could i change a random non-uniform distribution to a uniform distribution ? Is there a formula ? thanks . ...

Generating Full Period/Full Cycle Random Numbers or Permutations Similar to LCG but without odd/even

I wish to generate psuedo-random numbers/permutations that 'occupy' a full period or full cycle within a range. Usually an 'Linear Congruential Generator' (LCG) can be used to generate such sequences, using a formula such as: X = (a*Xs+c) Mod R Where Xs is the seed, X is the result, a and c are relatively prime constants and R is the ...

How can I get a random number from atmospheric noise?

I had a discussion recently about looking for a mehtod to generate truly random numbers. The discussion ended up talking about using atmospheric noise. Has anyone done this? What is involved in the process? Has anyone created a web service that returns random numbers obtained from noise? ...

How to select random values from a given range.

I'm trying to create an android application which will generate random series of values (integer numbers in this case) in a given range (but NOT equal between them) and display them in a simple TextView Let's say we have the range R = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] Each time I press the button "Generate" I want to randomly...

Finding a random WxH rectangle fitting in a MxN array region, where array[x][y] == number

I'm programming a game where a random map is generated whenever a new game is started. The game field is a MxN boolean array (true=ground, false=air.) From that array I calculate each connected free (air) regions, generating a new MxN int array where the int value is 0 if there's is ground, or the region number if it's free space (each f...

Generate multiple random numbers to equal a value in python

So here is the deal: I want to (for example) generate 4 pseudo-random numbers, that when added together would equal 40. How could this be dome in python? I could generate a random number 1-40, then generate another number between 1 and the remainder,etc, but then the first number would have a greater chance of "grabbing" more. ...

How to make rand() more likely to select certain numbers?

Is it possible to use rand() or any other pseudo-random generator to pick out random numbers, but have it be more likely that it will pick certain numbers that the user feeds it? In other words, is there a way, with rand() or something else, to pick a pseudo random number, but be able to adjust the odds of getting certain outcomes, and h...

Random String in VB

I need to generate a lot of random 2 character strings for my application. it's a VB console application. basically what I have tried for random strings is this: Private Function GenerateRandomString(ByVal intLenghtOfString As Integer) As String 'Create a new StrinBuilder that would hold the random string. Dim randomString As ...

Random number between -10 and 10 in JavaScript

Possible Duplicate: Generating random numbers in Javascript How do I get a random number between −10 and 10 in JavaScript? ...

How to make this random text generator more efficient in Python ?

Hello everyone, I'm working on a random text generator -without using Markov chains- and currently it works without too many problems. Firstly, here is my code flow: Enter a sentence as input -this is called trigger string, is assigned to a variable- Get longest word in trigger string Search all Project Gutenberg database for sentences...

How to create random image generator in asp.net mvc project c#

Hello all, I am looking for some solution of the random user image. I created some image and calling it from database if user has no image. But i dont like it, it is quite ugly. Is it exists some random image generator, like here in stackoverflow the the user has no photo. Please help me! Thanks and take care, Ragims ...