Lottery number generator
Hi Everyone,
I just bought myself a lottery ticket and as I was driving home why not write a small program to generate my own numbers? I came up with the following but I can't seem to figure out why I am getting the following error:
PLS-00306: wrong number or types of arguments in call to 'PUT_LINE'
code below.
declare
lot_num integer;
fst_num integer;
sec_num integer;
thrd_num integer;
begin
for lot in 1..3
loop
select dbms_random.value(00, 59) num into lot_num from dual;
If fst_num is null then
lot_num := fst_num;
elsif sec_num is null then
lot_num := sec_num;
elsif thrd_num is null then
lot_num := thrd_num;
end if;
end loop;
dbms_output.put_line(fst_num, sec_num, thrd_num); <==== It complains about this line. I tried the index named "lot" and the lot_num as a reference but no luck.
end;
Thanks for your help in advance.
Regards,
Al
Hi, Al,
I'm confused. Are there 6 distinct integers, or are there 5 distinct integers plus one that may be a duplicate?
Here's one way to generate 5 distinct integers in the range 1-60 plus a "powerball" number in the range 1-35, which may be the same as one of the first 5 numbers:
WITH got_r_num AS
SELECT LEVEL AS n
, ROW_NUMBER () OVER (ORDER BY dbms_random.value) AS r_num
FROM dual
CONNECT BY LEVEL <= 60
SELECT TO_CHAR (r_num, '99999999') AS label
, n
FROM got_r_num
WHERE r_num <= 5
UNION ALL
SELECT 'POWERBALL' AS label
, TRUNC (dbms_random.value (1, 36)) AS n
FROM dual
ORDER BY label
Sample output:
LABEL N
1 59
2 31
3 50
4 27
5 43
POWERBALL 10
If the order of the 5 distinct numbers is unimportant, you may want to change the main query a little:
WITH got_r_num AS
SELECT LEVEL AS n
, ROW_NUMBER () OVER (ORDER BY dbms_random.value) AS r_num
FROM dual
CONNECT BY LEVEL <= 60
SELECT NULL AS label
, n
FROM got_r_num
WHERE r_num <= 5
UNION ALL
SELECT 'POWERBALL' AS label
, TRUNC (dbms_random.value (1, 36)) AS n
FROM dual
ORDER BY label NULLS FIRST
, n
Sample output:
LABEL N
3
11
19
26
35
POWERBALL 11
The 5 unique numbers will always be shown in ascending order.
Similar Messages
-
Has anyone created a lottery number generator within Labview & if so can I have a copy please?
I would like to study the program of a lottery number generator for Labview if anyone has created or knows where I can get this.
Wow, my vi is close to yours, but I have a different problem: I set mine up to generate a door prize-winning "powerball," but my issue is how can I get the array to show each number in a different cell in the array, rather than in every cell at the same time. I think I need an array constant somewhere, but with a while loop in the for loop, I can't seem to come up with the desired operation.
Here's a copy of my vi and a pic of the "spaghetti"
Also, I'm running on my version 9 student edition.
Thanks for any help.
Attachments:
My Powerball.vi 53 KB
Lotto code.JPG 117 KB -
Report based on Serial Number generated in the Production Order
Hi,
I wish to generate a Customized report, which shall include the total consumption based on Sales Order/Line Item/Serial Number/Production Order matching the Serial Number generated in the Production Order where in we can get the required data.
Need your help and suggestions in creating this report..
Thanks in advance..
Ashok Vardhan
Edited by: Ashok T Vardhan on Jan 19, 2012 11:38 AMHello Tman,
This is a slightly tricky question. The reason being, the report options like the report path etc, are set before you see the serial number prompt when you run your UUT. There might be other ways of getting around this, but a quick solution would be modifying the process model.
I modified the PreUUT callback to set the report options. I passed the reportOptions as a parameter to this sequence. In the PreUUT sequence, I set the following fields:
Parameters.ReportOptions.GeneratePath=False
Parameters.ReportOptions.ReportFilePath= "c:\\"+ Locals.SerialNumber +"\\report.xml"
I hope this would give you an idea.
SijinK -
Plot xy graph using random number generator
How do i plot xy graph dynamically every 5 seconds with a random number generator?
X axis : Time
Y Axis : Random number generatorI've done tis so far. im able to plot dynamically every 1 second.
but the problem i am facing is The X axis display every 1 second.
i want it to be fixed 24 hours time format, and the data will gradually plots the data on y axis against x axis every one second, without changing the scale of the x axis (24hour time format) -
Arbitrary Number Generated before Sales Order Document number is Generated
I want to know which is the arbitrary number generated before the sales Order Document number is created. In which table the arbitrary number is stored?
The Exit which triggers the arbitrary number in the transaction VA01?Hi
You get the Arbitrary number throug the FM NUMBER_GET_NEXT.
interne Nummernvergabe
data: da_rc like inri-returncode.
call function 'NUMBER_GET_NEXT'
exporting
nr_range_nr = da_numki
object = 'RV_BELEG'
importing
returncode = da_rc
number = vbak-vbeln.
And regarding userexit, there is
perform userexit_number_range using da_numki statement in include MV45AF0B_BELEG_SICHERN.
Regards
Raj -
Is any request number generates when i create a sap script??
hi Gurus
I want to know Is any request number generates when i create a sap script??
if it is generates then how to find that request number???Hello,
A simple solution to find out the request number if thisis not released is, logon to SAP system with diffrent user ID other then the request owner's ID, a pop up message appears informing whether to create a new task under the xisting TR number.
If the TR i already released, then go to table E071 table and pass the object name. you can find all the related Tr's for the object. -
Hi does java have a random number generator. If it does can you point me to it please. Thank you.
you can use "java.Math.random()" this function returns a value which is greater than or equal
to 0.0 and less than 1.It returns a double value,so you can multiply by 10 and cast it to int,so that it
can produce numbers between 0 & 9.Yes, you can do that. But, as stated before, java.util.Random has methods that are easier to use for random int values than using java.Math.random is for random int values. It all depends what the OP wants. The OP hasn't come back with additional questions, or to say that he found his answer. So, we don't know whether he has his answer (he has several options now!) or not. :) -
Random Letter & Number Generator
Hello:
I'm new to programming (FormCalc & JavaScript) and I'm using Adobe LiveCycle Designer ES 8.2 to create a dynamic form to post online. I need help with creating a "random letter & number generator" in code. The purpose is when someone opens the form online; I will create a unique number/letter combo on the form.
Any help or direction would be much appreciated. Thanks!Hi,
I believe you are in the wrong forum. This is a forum for Adobe
LiveCycle Collaboration Service (LCCS) , a real-time social
collaboration platform.
You need to visit other forums under LiveCycle
http://forums.adobe.com/community/livecycle/livecycle_es?view=discussions
Primarily you can look for LiveCycle Forms sub forum.
Hope this helps
Thanks
Hironmay Basu -
Random Number Generator setSeed(); method???
I've searched and can't get a good understanding of the setSeed() method. I am suppose to use the loop control variable to seed the random number generator inside the loop. I need to use the same input everytime I use the random generator. When I compile it says int cannot be dereferenced.
for(int i = 0; i < array.length; i++)
int randnum = generator.nextInt(100);
randnum.setSeed(i);
array[i] = randnum;
If anyone can explain the setSeed() method that would be greatly appreciated. Thanks!badbro wrote:
Thanks for your help, but leave the smart comments to yourself. They are not needed. Thats what this forum is for.All of Paul's comments were dead spot on, and if you listen to him and take his advice to heart, it will only help you. If they make you upset, well then that's your problem, isn't it? My advice: grow up. -
Random Number Generator issues
Ok so I have an issue. I'm supposed to create a GUI app that has a frame that contains both a button and a textfield. When the button is pressed then a random number between 1 and 10 should appear in the textfield. I've got an illegal start of expression on line 49 which is the last private void...
So what have I done wrong?
* randomnumber.java
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.Random;
public class randomnumber extends JFrame
Random randomObject = new Random();
// declare controls used
static JButton startButton = new JButton();
static JTextField startTextField = new JTextField();
public static void main(String args[])
new randomnumber().show();
public randomnumber()
// frame constructor
setTitle("Random Number Generator");
getContentPane().setLayout(new GridBagLayout());
// add controls
GridBagConstraints gridConstraints = new GridBagConstraints();
startButton.setText("Generate a Number");
gridConstraints.gridx = 0;
gridConstraints.gridy = 0;
getContentPane().add(startButton, gridConstraints);
startButton.addActionListener(new ActionListener()
public void actionPerformed(ActionEvent e)
startButtonActionPerformed(e);
startTextField.setText("");
startTextField.setColumns(15);
gridConstraints.gridx = 2;
gridConstraints.gridy = 0;
getContentPane().add(startTextField, new GridBagConstraints());
private void startButtonActionPerformed(ActionEvent e)
myInt = randomObject.nextInt(11);
startTextField.setText(String.valueOf(myInt));
}Edited by: Hessmix on Oct 17, 2007 6:15 PMpublic randomnumber()
// frame constructor
setTitle("Random Number Generator");
getContentPane().setLayout(new GridBagLayout());
// add controls
GridBagConstraints gridConstraints = new GridBagConstraints();
startButton.setText("Generate a Number");
gridConstraints.gridx = 0;
gridConstraints.gridy = 0;
getContentPane().add(startButton, gridConstraints);
startButton.addActionListener(new ActionListener()
public void actionPerformed(ActionEvent e)
startButtonActionPerformed(e);
startTextField.setText("");
startTextField.setColumns(15);
gridConstraints.gridx = 2;
gridConstraints.gridy = 0;
getContentPane().add(startTextField, new GridBagConstraints());
}//<< Add a brace here
private void startButtonActionPerformed(ActionEvent e)
myInt = randomObject.nextInt(11);
startTextField.setText(String.valueOf(myInt));
}Did you add that brace? -
Random number generator. Even and odd numbers
I have a problem.
I have a random number generator, it goes from 0 to 20, I need to have two indicators, one will show how many numbers are pairs, and how many are not.
I tried to use the decimated 1D array, but since those numbers are random, it doesn´t work for me. I´m new with LabView, and I don´t know if there is some other way to make it work, I need some help, especially with some examples.
Thank you so much.
Solved!
Go to Solution.RavensFan wrote:
Spoiler (Highlight to read)
Create the array. Use quotient remainder to divide by 2. Now you have an array where all the odd numbers are now 1, and all the even numbers are now 0. Sum the array and you have the total number of odd numbers. The number of evens will be the length of the array divided by the # of odds.
Create the array. Use quotient remainder to divide by 2. Now you have an array where all the odd numbers are now 1, and all the even numbers are now 0. Sum the array and you have the total number of odd numbers. The number of evens will be the length of the array divided by the # of odds.
Haha I lost sight of the fact that he was looking for the amount off odds and evens. Good one.
Bill
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all. -
Help for random number generator???
hi there can anyone how to make simple random number
generator for slot machine , formula for chances in probability ,
or simple random number generator for slot machine , thanks
:)actualy the accurate RNG for slot machine ?? any idea?
-
Help: JSP Random Number Generator
hello every one,
Im trying to generate a random number using currentTimeMillis(), in Jsp, can you help me out and advice me how can this be done please.First you say you want a random number, then you say you want a unique one. Which is it?
Random numbers do not normally guaruntee uniqueness.
is there away i could use the currentTimeMillis(), What would you use it for? System.currentTimeMillis() is commonly used as a seed for a random number generator. The java.util.Random class uses it like that - take a look at that API link.
Or if its a homework question state the exact requirement - I'm guessing here. -
Random NUMBER generator help..
Hi all,
i'm having issues with my random number generator i'm trying to fill my array with random numbers but i keep getting it filled with zeros.... can any one tell me what i'm doing wrong i can;t figure it out..
for (int i =0; i < 100; i++){
int x=(int) (Math.random());
data[i] = x;
}From the API "Returns a double value with a positive sign, greater than or equal to 0.0 and less than 1.0."
So casting the value to int is always going to result in a zero value.
You need to multiply by a value that is one larger than the value you want to be your maximum. For example:
int x = (int)(Math.random() * 100);
should create a random number from 0 to 99 -
Defining a lower boundery for a random number Generator
Hi,
I am using the code:
Random rand = new Random();
int x = rand.nextInt(50);
to generate a random number between 0 and 49
However I now need to only select a number between 20 and 49
Is there any way to give the random number generator a lower boundery as well as an upper boundery ??
Thank you
Craigexample:int x = rand.nextInt(30) + 20;Will generate a number between 20 and 49.
Maybe you are looking for
-
HELP! My iPod keeps freezing
well it started yesterday...it froze on me so i just reset it...well today it froze on me 5 times....and now when i pulg it into my computer it pretty much freezs my computer...but whats weird is when i reset it, it keeps my setting...mostly just the
-
Java.lang.nullpointerexception when I deactivate the poa and shutdown the o
When I deactivate the poa and shutdown the orb I sometimes get this exception java.lang.NullPointerException at com.inprise.vbroker.orb.ORB.getThreadLocalObject(ORB.java:1050) at com.inprise.vbroker.orb.ServerThreadInfo.create(ServerThreadInfo.java:3
-
PGP encryption and moving of a file from one system to another
Hi All, Could you please provide me the necessary information in setting up the below jobs in Redwood CPS. a) How can i do pgp encryption to a file in a SAP system?. Could you please provide me the necessary steps. b) How can i do pgp encryption to
-
I have been using Firefox 31 browser and now have a problem with the Extensions I can not remove enformation 1.1 0.95.19 by marketing Enterprise 1.1 Enhance browsing Version 27 which puts an advertisement on all web pages. I have used Firefox suggest
-
My company uses Final cut pro 7 and I have to know if we can try Final cut pro X on one of our G5 and, in the case of we can't switch to FCPX, if we can use FCP7 again without re-initialise it. Thanks sorry for my english. it's not my maternal langua