English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. Blitz Basic

 
 
Thread Tools
Old 17 September 2016, 23:29   #1
Ze Emulatron
Registered User

 
Join Date: Nov 2010
Location: Invercargill, New Zealand
Posts: 176
Blitz Seed Random Number Generator

I was thinking about coding a program for the Amiga, but I want the random number generator to generate random numbers based on the seed I give it, so I can get the same results each time I run the program.

I do not want to generate the list of numbers once and then put it in an array.

Is this possible to set the seed with Blitz Basic ? I have had a look in the manual and reference material but cannot find what I am looking for.
Ze Emulatron is offline  
AdSense AdSense  
Old 18 September 2016, 03:40   #2
idrougge
Registered User
 
Join Date: Sep 2007
Location: Stockholm
Posts: 3,366
Use the Elmore library's randomiser instead.
idrougge is offline  
Old 25 September 2016, 02:41   #3
Ze Emulatron
Registered User

 
Join Date: Nov 2010
Location: Invercargill, New Zealand
Posts: 176
Thanks, I believe I have it working like I want.
Ze Emulatron is offline  
Old 26 November 2017, 11:08   #4
Ze Emulatron
Registered User

 
Join Date: Nov 2010
Location: Invercargill, New Zealand
Posts: 176
I had to write the code in Assembly to give me the results I wanted, It is the Linear congruential generator from Microsoft C


Code:
.randMS
  GetReg d0,MSState
  GetReg d1,0
  GetReg d2,0
  GetReg d3,0
  MOVE.w d0,d1
  MOVE.w d0,d3
  MULU #17405,d1
  SWAP d0
  MULU #17405,d0

  MOVE.l d3,d2
  ADD.l d2,d2
  ADD.l d3,d2

  ADD.l d2,d0
  SWAP d0
  MOVE.w #0,d0
  ADD.l d1,d0
  ADDI.l #2531011,d0
  ANDI.l #2147483647,d0

  PutReg d0,MSState

Return
Ze Emulatron is offline  
AdSense AdSense  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
seed of darkness password mike4466 support.Games 2 30 June 2011 12:29
random number generation (in asm) meynaf Coders. General 183 29 November 2010 19:48
Help needed!!Random octal numbers generator(asm) sheryn88 Coders. General 6 01 August 2010 07:19
Dark Seed so interlaced!!! kevingpo support.Games 1 29 September 2006 17:43
Dark Seed without flicker? MrZammler project.WHDLoad 30 02 January 2006 14:47

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


All times are GMT +2. The time now is 11:33.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.
Page generated in 0.05779 seconds with 13 queries