TeamPhotoshop
Reviews, updates and in depth guides to your favourite mobile games - AppGamer.com
Forum Home Latest Posts Search Help Subscribe

Generators

Page: 1 Reply
Aug 31st 2001#15033 Report
Member since: Jan 1st 1970
Posts:
How do I make a generator that cycles through certain numbers?

Kinda' like a password generator, but only cycles through certain numbers that I choose?

Thanks for the help...:D
Reply with Quote Reply
Sep 1st 2001#15085 Report
Member since: Jun 30th 2001
Posts: 447
What language? I assume you want JavaScript, correct?
Reply with Quote Reply
Sep 1st 2001#15115 Report
Member since: Jan 1st 1970
Posts:
Correct :D
Reply with Quote Reply
Sep 1st 2001#15132 Report
Member since: Jun 30th 2001
Posts: 447
[code]
// PLACE THIS CODE IN THE HEAD
// The Array Function
function makeArray(len)
{
for (var i = 0; i < len; i++) this[i] = null;
this.length = len;
}

// This is where the array of numbers is created
nums = new makeArray(4);
nums[0] = 1;
nums[1] = 2;
nums[2] = 4;
nums[3] = 7;

// The random number generator.
function rand(n)
{
seed = (0x015a4e35 * seed) % 0x7fffffff;
return (seed >> 16) % n;
}

var now = new Date()
var seed = now.getTime() % 0xffffffff

// PLACE THIS CODE IN THE BODY
// Where you place this is where the random number will be displayed (2 digits in length)
for (var i = 0; i < 2; i++) {
document.write(nums[rand(nums.length)])
}
[/code]
Reply with Quote Reply
Sep 1st 2001#15134 Report
Member since: Jan 1st 1970
Posts:
Dude, thank you soooo much!! :D
Reply with Quote Reply
Sep 2nd 2001#15158 Report
Member since: Jun 30th 2001
Posts: 447
no prob
Reply with Quote Reply
Page: 1 Back to top
Please login or register above to post in this forum