<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'Help!!! Generating Random Numbers' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'Help!!! Generating Random Numbers' posted on the 'Java Beginners' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2013 Programmers Heaven</copyright>
    <pubDate>Wed, 19 Jun 2013 12:21:33 -0700</pubDate>
    <lastBuildDate>Wed, 19 Jun 2013 12:21:33 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>Help!!! Generating Random Numbers</title>
      <link>http://www.programmersheaven.com/mb/java_beginners/430351/430351/help-generating-random-numbers/</link>
      <description>I keep getting duplicates, any suggestions??&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
import javax.swing.JOptionPane;&lt;br /&gt;
public class exam&lt;br /&gt;
{&lt;br /&gt;
	public static void main(String[]args)&lt;br /&gt;
	{&lt;br /&gt;
		int maxn = 45 , index , dupindex,anum;&lt;br /&gt;
		int numsneeded ,pass,comparison,temp;&lt;br /&gt;
		String results ;&lt;br /&gt;
		numsneeded = Integer.parseInt(JOptionPane.showInputDialog(null,
"please enter number of lotto numbers :"));&lt;br /&gt;
		int [] numbers = new int[numsneeded];&lt;br /&gt;
		for ( index= 0; index &amp;lt; numsneeded;index ++)&lt;br /&gt;
		{&lt;br /&gt;
			anum = (int)(Math.random()* maxn)+1;&lt;br /&gt;
			numbers[index] = anum;&lt;br /&gt;
			for (dupindex = 0 ; numbers[dupindex] != anum;dupindex++)&lt;br /&gt;
			if (index == dupindex)&lt;br /&gt;
			index ++ ;&lt;br /&gt;
		}&lt;br /&gt;
		for (pass = 1 ; pass &amp;lt;= numbers.length - 1 ;pass++)&lt;br /&gt;
		{&lt;br /&gt;
			for (comparison = 1 ;comparison &amp;lt;= numbers.length - pass ; comparison ++)&lt;br /&gt;
		&lt;br /&gt;
			{&lt;br /&gt;
					if (numbers[comparison-1] &amp;gt;numbers[comparison])&lt;br /&gt;
					{&lt;br /&gt;
						temp = numbers[comparison - 1 ];&lt;br /&gt;
						numbers[comparison - 1 ]= numbers[comparison];&lt;br /&gt;
						numbers[comparison] = temp;&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		results = "your lotto numbers are " + "\n";&lt;br /&gt;
		for (index = 0 ; index&amp;lt; numbers.length;index ++)&lt;br /&gt;
		results += numbers[index] + "\n";&lt;br /&gt;
		JOptionPane.showMessageDialog(null,results);&lt;br /&gt;
	}&lt;br /&gt;
}</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/java_beginners/430351/430351/help-generating-random-numbers/</guid>
      <pubDate>Wed, 21 Nov 2012 14:46:30 -0700</pubDate>
      <category>Java Beginners</category>
    </item>
  </channel>
</rss>