random

How to get some randomized concats based on 2 columns from 1 table?

Hey folks, i have a large user Database (13k+), and for some reason i need to create random names. The users table has "first_name" and "last_name". Now i want to have 10 concats of full_name and last_name of two completely random rows. Is that even possible with SQL? My other idea was just to create a full_names and last_names table …...

How to get a random letter from a list of specific letters ?

I've started writing some JAVA code and now I want to get a random letter from list of letters given so what should I use for this. ...

php get, random records, and the back button

My site has a library full of games, nations, game scenarios, etc. library.php is given a type=___ & id=___ for example library.php?type=scenario&id=ABCD001 library.php saves the id to a session variable and loads an include appropriate for the type This all works just dandy. Now, I wanted to give my users the option of pulling up a...

ideas for algorithm? sorting a list randomly with emphasis on variety

I have a table of items with [ID, ATTR1, ATTR2, ATTR3]. I'd like to select about half of the items, but try to get a random result set that is NOT clustered. In other words, there's a fairly even spread of ATTR1 values, ATTR2 values, and ATTR3 values. This does NOT necessarily represent the data as a whole, in other words, the total ...

Generating Random Paired Images in C#

im trying create cards matching game. normally these type of games they match paired cards together (with the same file name "A.jpg with A.jpg") but in my case, im matching cards with different names "B.jpg with A.jpg" (correct), "C.jpg with D.jpg" (correct) but with "B.jpg with C.jpg" (incorrect answer). A.jpg-B.jpg <--correct C.jpg-...

What is the best way to create a random value?

I am triying to create random value for my game to show enemies on screen. BUt it some times shows 2 together some times 3 ...I want to ask that which is the best formul for creating random value.. This is my so far random value random = 1 * (int) (Math.random() * 100); ...

Randomize numbers within a subset

I have a array of integer numbers (say 1,2,3,4,5 or 1,2,3, ... 10 or 1,2,3, ... 50) from which I would like to get a random set of numbers ordered differently every time. Is there a utility method to do this? e.g. for 1,2,3,4,5 post randomization it might be either [1,5,4,2,3 or 2,1,3,5,4 or 3,1,2,4,5 or ...] I would like to know if th...

Can't make an array in C#

I'm trying to make a dynamic array in C# but I get an annoying error message. Here's my code: private void Form1_Load(object sender, EventArgs e) { int[] dataArray; Random random = new Random(); for (int i = 0; i < random.Next(1, 10); i++) { dataArray[i] = random.Next(1, 1000); ...

Random position without overlapping

How to stop MCs from overlapping each other? private function loadWishes():void { for (i; i<myXMLList.length(); i++) { cBox=new MovieClip(); checkOverlap(cBox); addChild(cBox); commentArray.push(cBox); } } private function checkOverlap(wishB:MovieClip) { wishB.x=Math.random()*stage.stageWidth; wishB.y=M...

Display X divs randomly out of a possible Y.

How do I randomly display 3 divs out of a possible 10 in total? This is what I have tried so far: HTML: <div id="1">Content 1</div> <div id="2">Content 2</div> <div id="3">Content 3</div> <div id="4">Content 4</div> <div id="5">Content 5</div> <div id="6">Content 6</div> Javascript: function randomiseDiv() { // Define how man...

How are session identifiers generated?

Most web applications depend on some kind of session with the user (for instance, to retain login status). The session id is kept as a cookie in the user's browser and sent with every request. To make it hard to guess the next user's session these session-ids need to be sparse and somewhat random. The also have to be unique. The quest...

How to extract N random different elements from a set of unique elements?

I have a set of unique elements (there are not two identical elements). And I would like to extract N random and different elements from the set. What is the easiest way to do it in Java? ...

How to generate a random number from within a range - C

This is a follow on from a previously posted question: http://stackoverflow.com/questions/822323/how-to-generate-a-random-number-in-c I wish to be able to generate a random number from within a particular range, such as 1 to 6 to mimic the sides of a dice. How would I go about doing this? I'm used to C# and it seems to be a lot more d...

Can information encoded with a one time pad be distinguished from random noise?

I understand that the cyphertext from a properly used one time pad cypher reveals absolutely no data about the encrypted message. Does this mean that there is no way to distinguish a message encrypted with a one time pad from completely random noise? Or is there some theoretical way to determine that there is a message, even though you ...

Efficiently generate a 16-character, alphanumeric string

I'm looking for a very quick way to generate an alphanumeric unique id for a primary key in a table. Would something like this work? def genKey(): hash = hashlib.md5(RANDOM_NUMBER).digest().encode("base64") alnum_hash = re.sub(r'[^a-zA-Z0-9]', "", hash) return alnum_hash[:16] What would be a good way to generate random nu...

Generating a salt in PHP

What's the best way to generate a cryptographically secure 32 bytes salt in PHP, without depending on libraries seldom included in typical PHP installations? After some googling I discovered that mt_rand is not considered secure enough, but I haven't found a suggestion for a replacement. One article suggested reading from /dev/random bu...

Why is Random class isn't really random?

I've read about it on a message board - Random class isn't really random. It is created with predictable fashion using a mathematical formula. Is it really true? If so, Random isn't really random?? ...

Flex Canvas child Randomly resizes

Hi! I have an application with a viewstack that contains all the components that need to be displayed. The navigation is defined in the main application. All the components are based on canvas. The main application looks like that: <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:components="components...

How can you randomize the splash screen?

Is it possible to make the iphone app splash screen pick up a random image or text? So that it is different every time (e.g. display tips)? If so how? ...

Generate unique hashes for django models

I want to use unique hashes for each model rather than ids. I implemented the following function to use it across the board easily. import random,hashlib from base64 import urlsafe_b64encode def set_unique_random_value(model_object,field_name='hash_uuid',length=5,use_sha=True,urlencode=False): while 1: uuid_number = str(ra...