Translate C to Ahk Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
Prototyp
Posts: 21
Joined: 02 May 2017, 14:43
Location: Deutschland NRW

Translate C to Ahk

18 May 2017, 06:28

Hi, how i can translate the Original Mersennen Twister Code to ahk?



Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

Rohwedder
Posts: 545
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Translate C to Ahk

18 May 2017, 06:50

Hallo,
use https://autohotkey.com/docs/commands/Random.htm
This function uses the Mersenne Twister random number generator, MT19937, written by Takuji Nishimura and Makoto Matsumoto, Shawn Cokus, Matthe Bellew and Isaku Wada.
Prototyp
Posts: 21
Joined: 02 May 2017, 14:43
Location: Deutschland NRW

Re: Translate C to Ahk

18 May 2017, 08:31

Rohwedder wrote:Hallo,
use https://autohotkey.com/docs/commands/Random.htm
This function uses the Mersenne Twister random number generator, MT19937, written by Takuji Nishimura and Makoto Matsumoto, Shawn Cokus, Matthe Bellew and Isaku Wada.



i know the function. But I need the code what works in ahk.
stealzy
Posts: 51
Joined: 01 Nov 2015, 13:43

Re: Translate C to Ahk

18 May 2017, 14:36

HotKeyIt
Posts: 1536
Joined: 29 Sep 2013, 18:35
Contact:

Re: Translate C to Ahk

18 May 2017, 16:33

Try this:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

Prototyp
Posts: 21
Joined: 02 May 2017, 14:43
Location: Deutschland NRW

Re: Translate C to Ahk

19 May 2017, 01:13

HotKeyIt wrote:Try this:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus




Works Perfect.


:superhappy: :superhappy: :superhappy: :superhappy: :superhappy: :superhappy: :superhappy: :superhappy: :superhappy: :superhappy: :superhappy: :superhappy: :superhappy:
Prototyp
Posts: 21
Joined: 02 May 2017, 14:43
Location: Deutschland NRW

Re: Translate C to Ahk

19 May 2017, 11:04

:o :o :o :crazy: :crazy: :crazy: :crazy:

Something is wrong. the script ist repeating the pseudo numbers

The Script will visualize the problem. execute it.

for bench with the internal gen remove ;


Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

Last edited by Prototyp on 19 May 2017, 11:40, edited 2 times in total.
kon
Posts: 1760
Joined: 29 Sep 2013, 17:11

Re: Translate C to Ahk

19 May 2017, 11:20

x[kk:=A_Index] := x[A_Index+M] ^ (x[A_Index] >> 1) ^ mag01[mod(x[A_Index],2)]
Prototyp
Posts: 21
Joined: 02 May 2017, 14:43
Location: Deutschland NRW

Re: Translate C to Ahk

19 May 2017, 11:25

kon wrote:x[kk:=A_Index] := x[A_Index+M] ^ (x[A_Index] >> 1) ^ mag01[mod(x[A_Index],2)]


nope, this makes the Problem bigger
HotKeyIt
Posts: 1536
Joined: 29 Sep 2013, 18:35
Contact:

Re: Translate C to Ahk  Topic is solved

19 May 2017, 12:10

Sorry, there were 2 errors :oops:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

Prototyp
Posts: 21
Joined: 02 May 2017, 14:43
Location: Deutschland NRW

Re: Translate C to Ahk

19 May 2017, 12:20

HotKeyIt wrote:Sorry, there were 2 errors :oops:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



i see no difference :crazy:



You're incredibly good :o


K is the Position of the index right? , M and N is??
HotKeyIt
Posts: 1536
Joined: 29 Sep 2013, 18:35
Contact:

Re: Translate C to Ahk

19 May 2017, 15:40

+1 was missing :)
N is the size of Array, M is required to not exceed array size if I understand correct.
Prototyp
Posts: 21
Joined: 02 May 2017, 14:43
Location: Deutschland NRW

Re: Translate C to Ahk

20 May 2017, 12:11

im back with a Little problem :D
i try ad a own seed function, but he will not works.

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



Code: [Select all] [Download] GeSHi © Codebox Plus

static x := "[" seed() "]"



what is wrong?
HotKeyIt
Posts: 1536
Joined: 29 Sep 2013, 18:35
Contact:

Re: Translate C to Ahk

20 May 2017, 12:22

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

Prototyp
Posts: 21
Joined: 02 May 2017, 14:43
Location: Deutschland NRW

Re: Translate C to Ahk

20 May 2017, 12:29

You have to understand I'm a beginner. Thank you. Sorry for my bad english
Prototyp
Posts: 21
Joined: 02 May 2017, 14:43
Location: Deutschland NRW

Re: Translate C to Ahk

20 May 2017, 12:43

Hmm, seed() is blank?
Helgef
Posts: 2404
Joined: 17 Jul 2016, 01:02
Contact:

Re: Translate C to Ahk

20 May 2017, 13:01

Prototyp wrote:You have to understand I'm a beginner. Thank you. Sorry for my bad english

Prototyp wrote:Hmm, seed() is blank?

Do you know how to use a for loop to go through an array? Here is an example.

Code: [Select all] [Download] GeSHi © Codebox Plus

xy:=seed()
str:=""
for key, value in xy
str.= key " = " value "`n"
Msgbox, % str
Prototyp
Posts: 21
Joined: 02 May 2017, 14:43
Location: Deutschland NRW

Re: Translate C to Ahk

24 May 2017, 10:52

Helgef wrote:
Prototyp wrote:You have to understand I'm a beginner. Thank you. Sorry for my bad english

Prototyp wrote:Hmm, seed() is blank?

Do you know how to use a for loop to go through an array? Here is an example.

Code: [Select all] [Download] GeSHi © Codebox Plus

xy:=seed()
str:=""
for key, value in xy
str.= key " = " value "`n"
Msgbox, % str


No but now :D

Return to “Ask For Help”

Who is online

Users browsing this forum: mast4rwang and 41 guests