for selecting a uniquely defined no for people : for eg to take questions for people in a quiz as such that adjascent people face different questions we put forth the following logic:
take range=total_no_of_questions;
prime[]={list of prime nos other than two equal to no of people attending the quiz};
pos= math.random*(the no of people attending)
my_random=prime[pos]
for(int i=1;i<=range;i++)
{
my_question=(my_random*i)%range+1;
system.out.println("my random quetion no is : "+my_question);
{
my_question=(my_random*i)%range+1;
system.out.println("my random quetion no is : "+my_question);
}
check out this logic and comment here...
;)
No comments:
Post a Comment