Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Notices

Closed Thread
 
Thread Tools Display Modes
  #1  
Old 01-30-2010, 03:12 PM
BMR777 BMR777 is offline
Member
 
Join Date: Jan 2011
Posts: 1,122
Gender: Male
Credits: 18,612
BMR777 is on a distinguished road
Default RE: PHP: Have a 1/2 chance to add or subtract 1 ..?

The rand() function isn't truly random. I don't know why it isn't working, but I'll think about it and let you know if I come up with any ideas.
  #2  
Old 04-13-2011, 12:07 AM
Plague Plague is offline
Member
 
Join Date: Nov 2010
Posts: 50
Gender: Unknown/Other
Credits: 4,158
Plague is an unknown quantity at this point
Default

I could be wrong but I think the issue is here:

Code:
// $numnew = new number
// $curnum = current number
// $max = upper limit (5 in this case)

if (rand(1,2) == 1) {
$numnew = ($curnum + rand(-1,1));
}

if ($numnew == 0) {
$numnew = $max;
}

if ($numnew > $max) {
$numnew = 1;
}
I think maybe setting it like this:

Code:
if (rand(0,4) == 1) {
That might rectify the issue.
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Any chance.. lady jive Questions and Supports 3 03-29-2009 02:03 PM


All times are GMT -5. The time now is 08:50 PM.

Currently Active Users: 1931 (0 members and 1931 guests)
Threads: 4,081, Posts: 32,032, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636