
Archived topic from Iceteks, old topic ID:2230, old post ID:18783
Code: Select all
1: $stockprice = (rand(0,1000)+$stockprice)/1.6;
2: if(rand(0,4)=="3")$stockprice = $stockprice /rand(1,5);
3: $stockprice = round($stockprice);
[code]
$stockprice is the value loaded from the file at startup (the current price)
This algorthm is only run if a certain time interval has passed by, at that time, it rewrites it to file and it's the new price, otherwise it just skips the processing and sticks with the same price.
line 2 is to make a mini depression once in a while because without that the stock price slowly gos up more then it goes down. Line 3 is only to make sure it stays out of the decimals.
[color=#888888][size=85]Archived topic from Iceteks, old topic ID:2230, old post ID:18821[/size][/color]