Click here to Skip to main content
12,349,884 members (22,883 online)

JavaScript

 
AnswerRe: Browser Back Button Pin
vinodkumarnie18-Jan-13 22:33
membervinodkumarnie18-Jan-13 22:33 
AnswerRe: Browser Back Button Pin
Deepak Kr17-Feb-13 22:26
memberDeepak Kr17-Feb-13 22:26 
Generalhow can we set random image in my asp website? Pin
khiladi78631-Dec-12 5:43
memberkhiladi78631-Dec-12 5:43 
AnswerRe: how can we set random image in my asp website? Pin
Sandeep Mewara4-Jan-13 2:59
mvpSandeep Mewara4-Jan-13 2:59 
GeneralRe: how can we set random image in my asp website? Pin
khiladi78622-Jan-13 0:52
memberkhiladi78622-Jan-13 0:52 
GeneralRe: how can we set random image in my asp website? Pin
Sandeep Mewara22-Jan-13 2:34
mvpSandeep Mewara22-Jan-13 2:34 
Questiongenerate random numbers from specific array Pin
aeman29-Dec-12 22:16
memberaeman29-Dec-12 22:16 
AnswerRe: generate random numbers from specific array Pin
Sandeep Mewara4-Jan-13 3:06
mvpSandeep Mewara4-Jan-13 3:06 
aeman wrote:
want to generate number from given specific set of numbers

What's the problem with generating random number within a range, see if the random number is not the one you want and then re-get the random number in case it's the one you wanted to avoid?

Example;
Random number between 1 to 4.
You wanted one of (1,3,4)
If random number returned is 2, ignore and re-get it.

Define a method that takes range start, end and exclude number:
function getRandom(rangeStart, rangeEnd, excludeNo)
{
  var ranNo = GetRandom(rangeStart, rangeEnd);
 
  // ranNo either of: 1, 2, 3, 4
  if(ranNo == excludeNo)
    getRandom(rangeStart, rangeEnd, excludeNo);
  
  return ranNo;
}
Sandeep Mewara
Microsoft ASP.NET MVP 2012 & 2013


[My Latest Article(s)]:
How to extend a WPF Textbox to Custom Picker
Server side Delimiters in ASP.NET

AnswerRe: generate random numbers from specific array Pin
Joe DiNatale4-Jan-13 9:28
memberJoe DiNatale4-Jan-13 9:28 
AnswerRe: generate random numbers from specific array Pin
John Y.19-Feb-13 5:47
memberJohn Y.19-Feb-13 5:47 
Questionaccess info popup page Pin
apadana_198928-Dec-12 6:58
memberapadana_198928-Dec-12 6:58 
AnswerRe: access info popup page Pin
Sandeep Mewara4-Jan-13 3:13
mvpSandeep Mewara4-Jan-13 3:13 
AnswerRe: access info popup page Pin
vinodkumarnie18-Jan-13 22:56
membervinodkumarnie18-Jan-13 22:56 
Questioncontrol other page Pin
apadana_198928-Dec-12 6:50
memberapadana_198928-Dec-12 6:50 
AnswerRe: control other page Pin
aeman29-Dec-12 22:34
memberaeman29-Dec-12 22:34 
AnswerRe: control other page Pin
jkirkerx31-Dec-12 10:34
memberjkirkerx31-Dec-12 10:34 
QuestionProblem With jQuery AppendTo and Data Attributes Pin
AnalogNerd28-Dec-12 3:41
memberAnalogNerd28-Dec-12 3:41 
Questioncss Pin
SINNAM28-Dec-12 1:32
memberSINNAM28-Dec-12 1:32 
AnswerRe: css Pin
Keith Barrow28-Dec-12 2:33
mentorKeith Barrow28-Dec-12 2:33 
Questioncss Pin
SINNAM28-Dec-12 1:29
memberSINNAM28-Dec-12 1:29 
AnswerRe: css Pin
Sandeep Mewara4-Jan-13 3:14
mvpSandeep Mewara4-Jan-13 3:14 
AnswerFB Connect Javascript Pin
sasikumar.prs26-Dec-12 23:29
membersasikumar.prs26-Dec-12 23:29 
GeneralRe: FB Connect Javascript Pin
khiladi78631-Dec-12 5:40
memberkhiladi78631-Dec-12 5:40 
GeneralRe: FB Connect Javascript Pin
jkirkerx31-Dec-12 10:36
memberjkirkerx31-Dec-12 10:36 
AnswerRe: FB Connect Javascript Pin
Sandeep Mewara4-Jan-13 3:17
mvpSandeep Mewara4-Jan-13 3:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web02 | 2.8.160621.1 | Last Updated 25 Jun 2016
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid