Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 9    Views: 129

MGoBlue
Apple Fan
Profile
Posts: 980
Reg: Jun 07, 2011
Gold River, CA
10,600
06/19/12 03:21 PM (11 years ago)

Quiz Solution for Random Question Issues

Working on some more quiz apps and I came across a solution to the problem of random quiz questions not really being random. Right now, with the quiz plugin in both 1.5 and 2.0, when you have your questions set to random, if you completely close your app then restart it, the questions go in the exact same "random" order. To fix this, in the BT_screen_quiz.m file at around line 730, change "random()" to "arc4random()". Works much better in my testing.
 
mrDavid
BTMods.com
Profile
Posts: 3936
Reg: May 21, 2011
San Diego, CA
51,910
like
06/19/12 03:54 PM (11 years ago)
MGoBlue, awesome find! Is this something that the quiz plugin on btm could use for a update? If so, I can update the plugin, push it out to users, and leave appropriate credit to your find. Cheers, David. buzztouchmods.com
 
MGoBlue
Apple Fan
Profile
Posts: 980
Reg: Jun 07, 2011
Gold River, CA
10,600
like
06/19/12 04:07 PM (11 years ago)
Yes, I'd add it to the plugin. Seems to work much better than the random().
 
Crown Solutions
Aspiring developer
Profile
Posts: 463
Reg: Nov 11, 2011
MN
13,480
like
06/19/12 05:16 PM (11 years ago)
Very nice!! I have wondered about this.
 
Stobe
buzztouch Evangelist
Profile
Posts: 1527
Reg: Mar 04, 2011
Fredericksburg,...
24,670
like
06/19/12 05:25 PM (11 years ago)
Very cool. Good to know. ....time to go update....
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
06/19/12 10:18 PM (11 years ago)
Great find and fix, way to @MGoBlue. We are nearly completion on the 2.0 quiz for iOS and Android and have added this to the iOS implementation. Look for the quiz plugin for 2.0 download and hosted control panels soon.
 
MGoBlue
Apple Fan
Profile
Posts: 980
Reg: Jun 07, 2011
Gold River, CA
10,600
like
06/19/12 10:42 PM (11 years ago)
Great news, David. Can't wait.
 
mrDavid
BTMods.com
Profile
Posts: 3936
Reg: May 21, 2011
San Diego, CA
51,910
like
06/20/12 07:51 AM (11 years ago)
Guess I will just wait rather then making people download the new plugin and then download a new new one! Psyched! David. buzztouchmods.com
 
MGoBlue
Apple Fan
Profile
Posts: 980
Reg: Jun 07, 2011
Gold River, CA
10,600
like
06/24/12 11:13 AM (11 years ago)
I noticed that the random display of answers is also predictable, so you can also change the random() code in the "//randomize the answers.." section to arc4random().
 
mrDavid
BTMods.com
Profile
Posts: 3936
Reg: May 21, 2011
San Diego, CA
51,910
like
06/24/12 04:33 PM (11 years ago)
On the ball! David buzztouchmods.com
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.