Unique random

Hi all I need algorithm to generate unique random number.

but i need it all of them as digit number
and i need it it unique, if i have saved it before in a
DB , and i need to re-generate again i need unique number.I'll have to make a guess at what you mean...
Just use a cyclic random number generator, and save the "current position" somewhere.

Similar Messages

  • How to generate a unique random number in a MySQL db

    I'm creating a volunteer and also a separate vendor application form for an airshow. The volunteer and vendor info is stored in separate tables in a MySQL db, one row per volunteer or vendor. There will be about 100 volunteers and 50 vendors. When the application is submitted it should immediately be printed by the applicant, then signed and mailed in. This past year we had problems with some people who didn't immediately print their application so I'd like to still give them the option to immediately print but also send them an e-mail with a link to their specific row in the MySQL db. I have an autoincrement field as the primary key for each table, but I think sending this key to the applicant in an e-mail would be too easy for them to guess another id and access other people's info.
    I'm thinking I should add a column to each table which would contain a unique random number and I would then send this key in the e-mail to the applicant. So, can anyone suggest a simple way to do this or suggest a better way of giving the applicant a way to access their own application and no-one elses after they have submitted their form?
    Thanks all.
    Tony Babb

    Thanks so much, that was very helpful. I added the code you suggested to create and display the random number - I called it "vollink" and that worked fine. Then I added the hidden field toward the bottom of the form - it shows at line 311 when I do a "View Source in Int Explorer and then tried adding the code to add it to the table and when I tested it failed with "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1" . The test version of the page is here www.hollisterairshow.com/volunteerapp2.php . The changes I made to add it to the table is shown below , I must be missing something blindingly obvious, if you could suggest a fix I'd really appreciate it. I did add the field to the MySQL table also.
    Thanks again
    Tony
    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
      $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
      $insertSQL = sprintf("INSERT INTO volunteers (firstname, lastname, email, thursday, friday, saturday, sunday, monday, activity, talents, specialrequests, tshirt, phone, street, city, st, zip, updatedby, vollink) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, $s)",
                           GetSQLValueString($_POST['firstname'], "text"),
                           GetSQLValueString($_POST['lastname'], "text"),
                           GetSQLValueString($_POST['email'], "text"),
                           GetSQLValueString($_POST['thursday'], "text"),
                           GetSQLValueString($_POST['friday'], "text"),
                           GetSQLValueString($_POST['saturday'], "text"),
                           GetSQLValueString($_POST['sunday'], "text"),
                           GetSQLValueString($_POST['monday'], "text"),
                           GetSQLValueString($_POST['activity'], "text"),
                           GetSQLValueString($_POST['specialtalents'], "text"),
                           GetSQLValueString($_POST['specialrequests'], "text"),
                           GetSQLValueString($_POST['tshirt'], "text"),
                           GetSQLValueString($_POST['phone'], "text"),
                           GetSQLValueString($_POST['street'], "text"),
                           GetSQLValueString($_POST['city'], "text"),
                           GetSQLValueString($_POST['st'], "text"),
                           GetSQLValueString($_POST['zip'], "text"),
            GetSQLValueString($_POST['vollink'], "text"),
                           GetSQLValueString($_POST['lastname'], "text"));
      mysql_select_db($database_adminconnection, $adminconnection);
      $Result1 = mysql_query($insertSQL, $adminconnection) or die(mysql_error());

  • Array of unique random numbers - help?

    basically, i'm trying to create a BINGO card.
    i stared learning Java a week ago and am finding it easy to learn and use....at least so far.
    my instructor gave me the assignment to created a BINGO card. so i used the system.out.format command to make 5 tab fields, 8 spaces each ("%8s %8s %8s %8s %8s", "B", "I", "N", "G", "O"). although the assignment only wanted me to think numbers out of thin air, just to use as examples, i went above and beyond with the idea to make a BINGO card generator that could actually function.
    then i started the random number sequences, using the Math.random() command. all told, there are 24 of these in the program, one for each number on a bingo card. the field in the middle is the FREE space, so it has no Math.random command.
    in BINGO, each letter (one of my five tab fields) can have a number in ranges of 15. B is 1 to 15, I is 16 to 30, etc. it looks similar to this:
    B I N G O
    9 19 39 57 66
    3 28 32 51 74
    3 29 FREE 46 70
    14 28 43 55 67
    9 24 35 59 62
    as you can tell, i'm having trouble with actually making unique random numbers so that none repeat.
    is there a command or string or something to help me accomplish this?

    The best way I've come up with is to use an object to store the numbers that implements Collection--like ArrayList...
    Then you load it with the range of numbers that you want and call, shuffle() on the object, that will randomize your range of numbers and then you can choose the quantity you want from the storage object. So let's say you need 25 number in the range of 1 to 100:
    Add the numbers (you have to use classes so I would do Integers) 1 to 100;
    call shuffle()
    pull back the first 25 numbers
    This will guarantee that each number is distinct and in a random order.
    If you need multiple sheets populated, you can just call shuffle() between population of each sheet.
    package Junk;
    import java.util.ArrayList;
    import java.util.Collections;
    class Junk{
      private ArrayList<Integer> l;
      Junk(){
        l = new ArrayList<Integer>();
      public void loadList(int s, int e){
        for(int i=s; i<=e; i++){
          l.add(new Integer(i));
      public void randomizeList(){
        Collections.shuffle(l);
      public void printList5(){
        for(int i=0; i<5; i++){
          System.out.println(l.get(i));
      public static void main(String[] args){
        Junk j = new Junk();
        j.loadList(10,99);
        j.randomizeList();
        j.printList5();
        System.out.println();
        j.randomizeList();
        j.printList5();
    }

  • 7 digit unique random number

    I would like to generate 7 digit unique random number. I have it something like this :
    Random generator = new Random();
              generator.setSeed(System.currentTimeMillis());
              //generates seven digit random number.
              return generator.nextInt(9999999) + 999999;
    But it generates 8 digit numbers sometimes. I am giving the Max limit in the braces and min limit after the "+" sign. Could anybody help me figure out what is wrong.

    This is not a horrible solution but an intelligent &
    easy solution ;)Actually this would be the easy and intellegent solution to the problem "give a random 7 digit integer."
    Random generator = new Random();
    //generates seven digit random number.
    return generator.nextInt(10000000);Though the orginal post does not specify this as part of the problem others have assumed (probably correctly) that in fact the poster wants a number between 1000000 and 9999999 (inclusive) which can easily be produced with the following modification to the above.
    Random generator = new Random();
    //generates seven digit random number.
    return generator.nextInt(9000000) + 1000000;I am confused by your response. Are you saying the becasue the original question was asking why flawed code doesn't work, that makes your solution good?

  • Unique Random numbers

    How to get unique random numbers every time in AS3
    I have searched but not able to get satisfactory results

    var rand :Number;
    rand = Number(movXml.movie.length());
    for(var n:uint = 0 ; n<5 ; n++)
    num1 = Number(Math.round(Math.random()* ((rand-1) - 0) + 0 ) );
    if(tempArray.indexOf(num1) == -1)
    tempArray.push(num1);
    //trace(tempArray);
    num2  = Number (tempArray[0]);
    //trace("num1:"+num2);
    trace(tempArray);
    some time this produce more than 5 numbers
    and some time less than 3
    I want 4 random numbers , but different
    the above loop runs 4 times , so if number is repeated , it will not add to Array , hence i will not able to get 4 Required numbers

  • Unique random alpha num string

    Hi Guys,
    I have a unique question.
    I need to generate a unique random Alpha Num string.
    I cannot use 0,5,8 and 0,S,B in the generated output string.
    The string generated should be no more than length 7 max
    Pls help.

    Following solution generates random unique strings combinations
    from any given base set. Here is a sample output.
    $ java UniqueStringGenerator 7 100 10
    FCT2RYT
    2M31BU8
    VV8FU4Z
    BON2MKE
    OKUJZT0
    68E8X8S
    YTNLZAY
    CPEKPFP
    C176M24
    GQB9QE9The idea is quite simple.
    Pre-work:
    1. The base set is first mixed to increase entropy.
    2. All possible combinations are divide up into random buckets.
    Work for every unique string:
    1. Pick a bucket at random.
    2. Get next number in bucket.
    3. Convert the number to a unique string token.
    It is possible to adjust how much entropy you want in your
    sequence of generated combinations by choosing how many buckets
    the generator contains. However, every bucket will take up some
    memory.
    import java.util.*;
    import java.math.*;
    public class UniqueStringGenerator {
        public static String[] ALPHA_NUM =
         {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P",
          "Q","R","S","T","U","V","X","Y","Z",
          "0","1","2","3","4","5","6","7","8","9"};
        private List _parts = null;
        private List _buckets = null;
        private int _length;
        private BigInteger _range = null;
        public UniqueStringGenerator(String[] parts, int length,
                         int numberOfBuckets) {
         _length = length;
         // mixing the base set to increase entropy
         _parts = new Vector();
         List all = new Vector();
         for (int i = 0;i < parts.length;i++) {
             all.add(parts);
         while (all.size()>0) {
         int p = (int)(((double)all.size())*Math.random());
         _parts.add(all.get(p));
         all.remove(p);
         // dividing all possible numbers into given number of buckets
         BigInteger numParts = BigInteger.valueOf(parts.length);
         _range = BigInteger.ONE;
         for (int i = 0;i<_length;i++) {
         range = range.multiply(numParts);
         TreeSet starts = new TreeSet();
         Random rand = new Random();
         while (starts.size()<numberOfBuckets-1) {
         BigInteger bi = new BigInteger(_range.bitLength(), rand);
         if (bi.compareTo(_range)<=0) {
              starts.add(bi);
         _buckets = new Vector();
         Bucket last = new Bucket(BigInteger.ZERO);
         _buckets.add(last);
         for (Iterator i = starts.iterator();i.hasNext();) {
         Bucket next = new Bucket((BigInteger)i.next());
         _buckets.add(next);
         last.setTo(next.getStart());
         last = next;
         last.setTo(_range);
    private class Bucket {
         private BigInteger _start;
         private BigInteger _next;
         private BigInteger _to;
         public Bucket(BigInteger start) {
         _start = start;
         _next = start;
         public void setTo(BigInteger to) {
         _to = to;
         public BigInteger getStart() {
         return _start;
         public boolean hasNext() {
         return next.compareTo(to)<0;
         public BigInteger next() {
         BigInteger ret = _next;
         next = next.add(BigInteger.ONE);
         return ret;
         public String toString() {
         return "["+start+", "+next+", "+_to+"]:"+hasNext();
    public String nextUnique() {
         // getting next big integer
         BigInteger left = null;
         while (left==null) {
         Bucket b = (Bucket)
              buckets.get((int)(Math.random()*buckets.size()));
         if (b.hasNext()) {
              left = b.next();
         // converting it to a combination
         StringBuffer unique = new StringBuffer();
         BigInteger base = BigInteger.valueOf(_parts.size());
         for (int i = 0;i<_length;i++) {
         BigInteger[] resRem = left.divideAndRemainder(base);
         left = resRem[0];
         unique.append(_parts.get(resRem[1].intValue()));
         return unique.toString();
    public static void main(String[] args) {
         if (args.length!=3) {
         System.out.println("Usage: UniqueStringGenerator "+
                   "[string size] [# buckets] [# prints]");
         return;
         int length = Integer.parseInt(args[0]);
         int numBuckets = Integer.parseInt(args[1]);
         int num = Integer.parseInt(args[2]);
         UniqueStringGenerator usg = new UniqueStringGenerator
         (UniqueStringGenerator.ALPHA_NUM, length, numBuckets);
         for (int i=0;i<num;i++) {
         System.out.println(usg.nextUnique());

  • TSP: Generating N unique random indices in tricky set

    Hi! I'm working on a type of the euclidian travelling salesman problem, and I'm going to try to solve it using an Genetic Algorithm.
    One solution may be a route like this: 1-2-4-3-7-6-5. This means travel from town 1 to 2 etc up to city number 5 and also implies travelling
    back to town 1 after town 5. Since the distances between cities are symmetrical, the above given solution is equal to the solution
    1-5-6-7-3-2 (since the route 1-2-4-3-7-6-5-1 is equal (in travelling distance) to 1-5-6-7-3-4-2-1 due to symmetry).
    I need to create an initial population of N solutions. These need to be unique, preferrably totally random solutions in the set of possible
    solutions (wich is this case does not consist of all possible permutations!). Is there a way of doing this without running the risk of
    getting stuck in a loop (generating the same solutions many times and retrying)? I don't want to risk this, since speed is an issue.
    I've thought about ranking solutions and unranking them, but this involves computing faculties, and that may be very time consuming
    and does not seem to be the optimal solution, although i've seen some implementations running in time complexity O(N).
    Note: the number of cities may vary.
    Any thoughts?
    Regards
    Alex

    Generating a random order of indices is not that difficult.
    int[] arr = new int[n];
    for (int i = 0; i < n; i++)
        arr[i] = i;
    for (int i = 0; i < n; i++) {
         int k = (int) (Math.random() * n);
         int x = arr[k];
         arr[k] = arr;
    arr[i] = x;
    However, when dealing with a graph this approach probably doesn't
    make that much sense, since it's unlikely there is an edge between
    every node.
    You probably want to generate an initial population where sequential
    indices are adjacent nodes.
    An alternative to GA is to determine the minimum spanning tree, and
    traverse that. The MST appoach is within a factor of 2 of optimal. If
    you're stuck on GA for this problem, then I think the hardest part is to
    determine a good appoach for combining two solutions.

  • How to generate unique random numbers

    Hi All,
    I am wondering whether there is already a random library or built-in function available in Java to produce some random numbers between certain ranges that are not repetitive. Let's look at a common examples as follows:
    Random diceRoller = new Random();
    for (int i = 0; i < 10; i++) {
      int roll = diceRoller.nextInt(6) + 1;
      System.out.println(roll);
    }My understanding from this approach is that it allows the same number to be repeated over and over again. However, I would like to find out how to continue generating random numbers from remaining ones that haven't been generated earlier.
    Using the above example to illustrate my intention:
    1st random number generated - possibility of 1 - 6 showed up. Say 5 is picked.
    2nd random number generated - possibility of 1, 2, 3, 4, 6 only. Say 2 is picked.
    3rd random number generated - possibility of 1, 3, 4, 6 available. Say 1 is picked.
    4th random number generated - possibility of 3, 4, 6 left. Say 6 is picked.
    5th random number generated - possibility of 3, 4 remains. Say 4 is picked.
    Any assistance would be much appreciated.
    Many thanks,
    Jack

    htran_888 wrote:
    Hi All,
    I am wondering whether there is already a random library or built-in function available in Java to produce some random numbers between certain ranges that are not repetitive. Let's look at a common examples as follows:
    Random diceRoller = new Random();
    for (int i = 0; i < 10; i++) {
    int roll = diceRoller.nextInt(6) + 1;
    System.out.println(roll);
    }My understanding from this approach is that it allows the same number to be repeated over and over again. However, I would like to find out how to continue generating random numbers from remaining ones that haven't been generated earlier.
    Using the above example to illustrate my intention:
    1st random number generated - possibility of 1 - 6 showed up. Say 5 is picked.
    2nd random number generated - possibility of 1, 2, 3, 4, 6 only. Say 2 is picked.
    3rd random number generated - possibility of 1, 3, 4, 6 available. Say 1 is picked.
    4th random number generated - possibility of 3, 4, 6 left. Say 6 is picked.
    5th random number generated - possibility of 3, 4 remains. Say 4 is picked.
    Any assistance would be much appreciated.If it is your school assignment then you have the answer above (List & the lists length).
    (You might want to look at Collections)

  • How can I generate multiple unique random numbers?

    Hello,
    I am trying to generate multiple random numbers between a given set of numbers (1-52) and not have the same number generated twice within that set. I can compare the last and next numbers with the compare function but how would I go about comparing all of the generated numbers without using a huge list of shift registers...
    Any help/ideas are welcome and appreciated.
    Jason
    Solved!
    Go to Solution.

    Here is an implementation of Jason's solution.
    steve
    Help the forum when you get help. Click the "Solution?" icon on the reply that answers your
    question. Give "Kudos" to replies that help.
    Attachments:
    random.vi ‏10 KB

  • Unique Random Values

    OK, firstly, I am a Java n00b. I am not creating a program, just editing some source, but I need some help. What I need, are 5 different variables, each with a random value (integer) between 1 and 5 (inclusive), but, I don't want to variables to have the same value. The outcomes I'm looking for could be as follows:
    t = 4
    i = 3
    g1 = 5
    g2 = 1
    y = 2
    and then the next time the code is run I might get:
    t = 1
    i = 5
    g1 = 4
    g2 = 2
    y = 3
    Each variable has a random value (integer) between 1 and 5 (inclusive), but no 2 variables have the same value.
    Here is what I tried:
         Random rand = new Random();
         int t = (rand.nextInt(5) + 1);
         int i = (rand.nextInt(5) + 1);
         int g1 = (rand.nextInt(5) + 1);
         int g2 = (rand.nextInt(5) + 1);
         int y = (rand.nextInt(5) + 1);
    // While i is the same as t, make i a new random integer between 1 and 5. Yes? Or no...?
         do {
         i = (rand.nextInt(5) +1);
         } while (i == t);
         do {
         g1 = (rand.nextInt(5) +1);
         } while (g1 == t);
         do {
         g1 = (rand.nextInt(5) +1);
         } while (g1 == i);
         do {
         g2 = (rand.nextInt(5) +1);
         } while (g2 == t);
         do {
         g2 = (rand.nextInt(5) +1);
         } while (g2 == i);
         do {
         g2 = (rand.nextInt(5) +1);
         } while (g2 == g1);
         do {
         y = (rand.nextInt(5) +1);
         } while (y == t);
         do {
         y = (rand.nextInt(5) +1);
         } while (y == i);
         do {
         y = (rand.nextInt(5) +1);
         } while (y == g1);
         do {
         y = (rand.nextInt(5) +1);
         } while (y == g2);But when I use the variables in the next part of the program, sometimes it works, but sometimes 2 of them are the same. Sometimes even 4...
    Can someone help me please?

    Thinking about it now though, I would like to learnproperly. What is a good Java guide that starts from
    scratch?
    I think the Core Java books, by Cay Horstmann, are a
    great way to start learning Java. I refered to his
    books constantly durning college:
    http://www.amazon.com/exec/obidos/tg/detail/-/013148202
    /qid=1096410169/sr=1-1/ref=sr_1_1/104-3324308-3016709?v
    glance&s=books
    Sun's basic Java tutorial
    Sun's New To Java Center. Includes an overview of what Java is, instructions for setting up Java, an intro to programming (that includes links to the above tutorial or to parts of it), quizzes, a list of resources, and info on certification and courses.
    http://javaalmanac.com. A couple dozen code examples that supplement The Java Developers Almanac.
    jGuru. A general Java resource site. Includes FAQs, forums, courses, more.
    JavaRanch. To quote the tagline on their homepage: "a friendly place for Java greenhorns." FAQs, forums (moderated, I believe), sample code, all kinds of goodies for newbies. From what I've heard, they live up to the "friendly" claim.
    Bruce Eckel's Thinking in Java (Available online.)
    Joshua Bloch's Effective Java
    Bert Bates and Kathy Sierra's Head First Java.

  • Unique random array

    i need to make a method that fills an array with random integers from 0 to 51, every integer may only appear once. can someone please give me some tips? here is what I have so far:
    import java.util.*;
    public class tryout
         public static void main(String[] args)
              int deck [] = new int [52];
              deck = shuffleDeck();
              for(int i = 0; i < 52; i++)
                   System.out.println(deck);
         private static int[] shuffleDeck()
              Random rand = new Random();
              int[] card = new int[52];
              for(int i = 0; i < 52; i++)
                   card[i] = rand.nextInt(51);
              return card;
    Edited by: skine1 on Mar 16, 2008 5:29 AM

    import java.util.*;
    import java.util.Collections.*;
    public class tryout
    public static void main(String[] args)
    int deck [] = new int [52];
    deck = shuffleDeck();
    for(int i = 0; i < 52; i++)
    System.out.println(deck);
    private static int[] shuffleDeck()
    Random rand = new Random();
    int[] card = new int[52];
    for(int i = 0; i < 52; i++)
    card[i] = i;
    List deck = Arrays.asList(card);
    List.shuffle(deck);
    * card = List.toArray(deck);*
    return card;
    the compiler message said ther were symbols missing for the two lines i put in bold

  • HOW DO I KEEP AN ARRAYLIST IN RANDOM ORDER AFTER EXITING THE SUB ROUTINE CONTAINING IT

    PLEASE HELP!I am trying to go from VB4 which I loved to VB2010 which I find somewhat more challenging. I’ve searched the web for help and have adapted the following to my project. This code does
    rotate randomly through every card in the deck and displays unique cards until all have been drawn. BUT I want to draw one card
    only from the first “hat” of Boy’s names; then draw the second card from the second “hat” of Girl’s names and repeat this process until all cards in both decks have been drawn. How do I get the TextBox (OR any
    MsgBox) to display JUST ONE unique random card at a time so I can exit that deck and go to the next deck?
    On my form, I have two TextBoxes (to display the names (as drawn), two buttons (to re-load each deck once exhausted) and one command (&End)control (to end the process). I created two ArraysLists
    (to hold the Boys names and Girls names separately) and two ArrayLists to hold the cards for the random decks when created in code.
    I can
    NOT get this code to draw random UNIQUE names once I exit the deck. I have tried to ReDim the deck; randomly pull a card from the second (temp) deck, etc
    NOTHING seems to work.
    WHY does my deck lose randomness once I exit it?
    How can I fix it? I don’t understand this. Below is the code for the "hat" with the 10 girl's names.
    Also, when I don't loop through all the cards, I usually get "An Out of Index exception was not handled" error. Hope someone can help me with this problem. It seems like this should
    be easy BUT I'm baffled. Thank you for any help.
    Imports System.Collections.Generic
    Public Class Form1
    Dim Count As Integer
    Dim Rcard As New ArrayList
    Dim Dcard As New ArrayList
    Dim NewRDeck As New ArrayList
    Dim NewDDeck As New ArrayList
    Dim temp_Rnum As Integer
    Dim temp_Dnum As Integer
    Dim MyRand As New Random()
    Public Sub Rcards_Click(sender As Object, e As System.EventArgs) Handles Rcards.Click
    While Rcard.Count > 0
    Dim temp_Rnum As Integer = Int(MyRand.Next(Rcard.Count))
    NewRDeck(temp_Rnum) = Rcard(temp_Rnum)
    Rem Check that the ArrayLists work correctly and display properly
    MsgBox(Rcard(temp_Rnum), , "New random card selected is: ")
    Console.WriteLine(Rcard(temp_Rnum))
    Rcard.Text = (Rcard(temp_Rnum))
    REM Now remove the Rcard with the random number generated so it can't be drawn again
    Rcard.RemoveAt(temp_Rnum)
    End While
    REM When all 10 cards have been picked, alert player to re-load deck if desired.
    MsgBox("No new cards left in deck; please Re-Load the cards. Thank you.")
    EndSub
    End Class

    Hi Acamar,
    Thank you for such a fast response. Sorry if my text wasn't clear. I'm really struggling with creating unique random elements in Collections in VB2010 and feel I understand ArrayLists better than some of the other Collection types.The code works perfectly
    and generates unique random cards until the original deck is exhausted. Then it prompts the user to re-load the original deck so it can be reused if needed. But I need to draw one card only and exit the deck. Then when I click on the TextBox again, I want
    that deck to be in the same random order - just minus any cards I have already drawn and thrown away.  Thanks again for your help.
    Here's the rest of the code for just the girl's "hats" of names, if it helps:
    Private Sub btnShuffleRCards_Click(sender
    As System.Object, e
    As System.EventArgs)
    Handles btnShuffleRCards.Click
    Dim j As
    Integer
    For j = 1 To 10
    NewRDeck.Add(j)
    Next j
    Randomize()
    REM Create original Deck with names for the girls.
    Rcard.Add("1 HELEN”)
    Rcard.Add("2 OLIVIA")
    Rcard.Add("3 <st1:city w:st="on"><st1:place w:st="on">ALICE</st1:place></st1:city>")
    Rcard.Add("4 VALERIE")
    Rcard.Add("5 DONNA")
    Rcard.Add("6 ZELDA")
    Rcard.Add("7 MARGARIE")
    Rcard.Add("8 <st1:city w:st="on"><st1:place w:st="on">NANCY</st1:place></st1:city>")
    Rcard.Add("9 WANDA")
    Rcard.Add("10 IRENE")
    End Sub

  • Program to pic random files

    I have a folder with thousands of pics in it. I need a way to randomly
    pic just 1000 and store in another folder..Anyone seen anything like
    this?

    You can ask the question a different way: You have a set of values from 1 to, say, 10,000 (1 = picture1, 2 = picture2, etc). You want to generate a set of unique random numbers. See this thread for a few ways to do that: How can I generate multiple unique random numbers?

  • 8 digit random number

    Hi,
    Can any one help me to generate 8 digit unique random number, i have code some thing like
    new Random().nextInt(100000000) + 1, but it generating 7 digit random number some times.
    please give me the solution
    thanks,
    pvmk

    pvmk wrote:
    Is there any alternate logic to generate 8 digit random numberAs already implied
    if you want random numbers in the range [10000000;99999999]
    generate random numbers in the range [0;90000000[ and add 10000000                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How to generate random strings

    Gday all,
    So I have to create a simple guessing game where the user guesses a 3 letter string that is randomly generated:
    "For each new game your program will generate three unique random numbers between 0 and 9
    inclusive, and convert them into a String of three characters in the range A to J. This String will be an
    input to a game, where the user tries to guess the correct letters in the correct order. Examples of valid
    input Strings would be, �JAD�, �ABC�, �IBE� and �EFG�. Examples of some invalid input Strings could be
    �abc�, �AAA�, �123�, �AdE� or �NME�."
    Just wondering how to create this random string? I know how to generate a random 3 char number (num = (int) (Math.random() * 1000)) but I dont know how to convert this into a corresponding string, as the instructions say.
    I know this is very basic, but any tips?

    I know how to generate a random 3 char number (num = (int) (Math.random() * 1000)) but I dont know how to convert this into a corresponding stringUse string concatenation (+ with one or two String operands).
    int i = 42;
    char ch1 = '*';
    char ch2 = '!';
    String str = "foo";
        // the System.out.println() is not important
        // in each case a string is being created and printed
    System.out.println("" + i);
    System.out.println("2 times i = " + (2 * i));
    System.out.println(i + "*2=" + (2 * i));
    System.out.println("" + ch1 + ch2); // hint, hint
    System.out.println(1 + 2 + "???");
    System.out.println("???" + 1 + 2);

Maybe you are looking for

  • Can't update windows 7 service pack 1, can I use windows 8 for AirPort Extreme on my laptop?

    I need help! I'm trying to set up AE with 3 laptops, a desk top, an ipad and two iPhones! Got the software downloaded onto all but one laptop. My laptop won't configure windows 7 service pack 1 so the AE software won't install. I've tried all Microso

  • WAD : Call Javascript Function only on Initial Load

    Hi I need to replicate the functionality found in the web template parameter ACTION_BEFORE_FIRST_RENDERING in a Javascript function. I need to to do this in order to read a querystring parameter, and then perform actions based on that querystring par

  • Why we need Custom controllers in Model Applications

    Hi Friends In Adaptive RFC Model Application we can use both the controllers for creating contex structure wat is the main aim for using custom controller it has any special feature in custom conrollers i read both the controllers have same functiona

  • Ods invalid characters

    bwpals, i am in support, my issue is data loaded to ods but not available for reporting , error its showing invalid character in record .again i changed in psa level but for next load from r3 same error is coming again.so how to change it from r3 sid

  • "Stupid design of regular expression in java"

    I bet majority will stumble on this: String inputStr = "a,,b"; String patternStr = ","; String[] fields = inputStr.split(patternStr); result: ["a", "", "c"] so if inputStr = ,, then result: ["","",""] ?? If you think so, give yourself a treat. Now gi