Solved

on line contest

Posted on 2011-02-23
9
409 Views
Last Modified: 2013-12-26
Hi experts

 My problem is as follows

 I want to do an online contest and I want those who are online  watch, I have the code for random numbers but i can not present the same numbers in all online clients. each client  getting different random numbers.

Is there any way to do this ?

Same time in all online clients a pop up window running my random number script but having the same result in all ?

 Thank you
0
Comment
Question by:farmakis
  • 2
  • 2
  • 2
  • +2
9 Comments
 
LVL 26

Accepted Solution

by:
wilcoxon earned 250 total points
ID: 34965317
Sure.  The obvious "naive" approach is to salt the random number generator with a unique based value.  Something like srand(int_mac_address+time()) - I'm pretty sure you want to do more manipulation of the srand value to prevent predictability.
0
 
LVL 13

Assisted Solution

by:Carl Bohman
Carl Bohman earned 250 total points
ID: 34970601
It's not clear from the question whether the random number generator script is in the pop up window or on the server.  The only way to guarantee that each person sees a different random number is to have the random numbers generated on and come from the server (and have the server keep track of what numbers have already been generated so that duplicates are not possible).  If each client comes up with its own random number, the change of getting duplicates will always exist.

Assuming the server is generating the numbers in a way that avoids duplicates, you just need to send a different number to each client.
0
 

Author Comment

by:farmakis
ID: 34975098
Thank you both for your answers

Maybe I was not quite clear

I be;ieve that the script must run on server side because i want to generate a 8 digit random number once,
My problem is that i want all online clients can see the generation of the number same time in a pop up window. All clients must see the generation process at their screens and the number must be the same for all. The one that the server generates.

You can take it like an online lottery that only one can win ( the number that server generates ) buy onli must see the generation process when this is happend.

I don;t know if i can give you a link so you can see exactly what the script do so ypu can help me.

Thanks again

Ilias
0
How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

 
LVL 13

Expert Comment

by:Carl Bohman
ID: 34975195
This is more of a web programming question, then.  It looks like you need to notify the clients when the number becomes available.  Most likely you are talking AJAX.
0
 
LVL 26

Expert Comment

by:wilcoxon
ID: 34975238
It could certainly be done with AJAX (not really my area of expertise).

It should also be possible to be done in more of a client-server style.  The server generates the random number seed and then the web page that each person looks at simply retrieves the seed and re-generates the list of random numbers (given the same seed and same PRNG, the list of random numbers will stay the same).  The upside to this method is that you can skip AJAX - the downside is that the viewer won't necessarily know as soon as the random numbers are available.

In any case, as bounsy says, this is a web programming question.
0
 

Author Comment

by:farmakis
ID: 34975538
OK Thanks again both for your aswers.

I;ll ask there

Anyway If you think you give mr your opinions the page is here

http://www.travelbookstore.gr/index/Win4Popup.htm

Many Thanks again

Ilias
0
 
LVL 10

Expert Comment

by:ReneGe
ID: 35471553
@farmakis

Like "bounsy" was suggesting, you may want to change the zones of your question.

You could ask advise from the moderators:
http://www.experts-exchange.com/Programming/Languages/Scripting/Shell/Batch/requestAttention.jsp?attention&refType=10&refID=26843181
0
 
LVL 9

Expert Comment

by:Suhas .
ID: 37319319
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
You may have already been in the need to update a whole folder stucture using a script. Robocopy does it well and even provides a list of non-updated files in a log (if asked to). Generally those files that were locked by a user or a process by the …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question