English
Forum

Rnd() of greater value as Long

 

Jörg
Sellmeyer
gives it a Possibility a Zufallszahl a area ulterior the Longgrenze To detect.

If I
Var n! = 4^16
Print Rnd(n!)
use, comes only 0 out. Gibts there what by Api or so?
Greeting
Jörg
 
Windows XP SP2 XProfan X4
... und hier mal was ganz anderes als Profan ...
12/08/07  
 



ex in String and then to that Float or mean You something other?
CompileMarkSeparation
string s

whileloop 12 {s=s+str$(rnd(10))}

float f=val(s)/pre>
 
12/08/07  
 




Jörg
Sellmeyer
Yes the Have I already, but the numbers can not higher as 4^16 his.
 
Windows XP SP2 XProfan X4
... und hier mal was ganz anderes als Profan ...
12/08/07  
 




Jörg
Sellmeyer
strange - Why diving because Franks Posting only here on:
[...] 

The Solutions having unfortunately any whom disadvantage, that tappt im dunkeln no 4^16 To 1 probability image, separate any kombinatorischen.
Z. B. is with one real Rnd() with large numbers The probability 1:1, that the number larger or small is, as 4^16 : 2.
In iFs example is the probability but already 10:1, that the number 10-stellig is (4^16 is incidentally 10- and not 12-stellig).
Ähnliches counts for Franks (verschwundenes) example.
has someone ne idea, How I the concern could? or could the even in Profan be installed? is probably ne solid verdrahtete Delphilösung, or?
 
Windows XP SP2 XProfan X4
... und hier mal was ganz anderes als Profan ...
12/11/07  
 




Michael
Wodrich
self knit - example
CompileMarkSeparation
Declare Zufall_Save!, Zufall_Obergrenze!

Proc Zufall

    Declare x1!,x2!
    x1! = (Zufall_Save! * 65539)
    x2! = Round((x1! / Zufall_Obergrenze! - 0.5),0) * Zufall_Obergrenze!
    Zufall_Save! = x1! - x2!
    Return Zufall_Save!

EndProc

Declare x!
Zufall_Obergrenze! = (4.0^16) - 1
Zufall_Save! = 7

repeat

    cls
    print obergrenze.:, format$(#,0,Zufall_Obergrenze!),    WaitKey: 13 = Enter = weiter, sonst Ende
    print save.......:, format$(#,0,Zufall_Save!)
    print
    print die Zufallszahl;tab(45);Kontrollwert (Max - Zufall)

    whileloop 20

        x! = zufall()
        print x=,format$(#,0,Round(x!-0.5,0));tab(45);format$(#,0,Round(Zufall_Obergrenze! - x! - 0.5,0))

    endwhile

    waitkey

until %key <> 13

end

About The distribution can I but nothing say - be no Mathematiker

Best wishes
Michael Wodrich
 
Programmieren, das spannendste Detektivspiel der Welt.
12/11/07  
 




Frank
Abbing

strange - Why diving because Franks Posting only here on:


Perhaps because I my Posting again deleted having? I found The method later badly, because the detour a area Yes none necessary is is.
 
12/11/07  
 




RGH
Jörg Sellmeyer
gives it a Possibility a Zufallszahl a area ulterior the Longgrenze To detect.

If I
Var n! = 4^16
Print Rnd(n!)
use, comes only 0 out. Gibts there what by Api or so?
Greeting
Jörg


Why take You do not simply chance! = rnd(4^8) * rnd(4^8)?
the Result is always >= 0 and < 4^16.

Greeting
Roland
 
Intel Duo E8400 3,0 GHz / 4 GB RAM / 1000 GB HDD - ATI Radeon HD 4770 512 MB - Windows 7 Home Premium 32Bit - XProfan X4
12/11/07  
 




RGH
Pardon:
an better (korrekte) distribution the Zufallszahlen get one naturally with:
CompileMarkSeparation
Zufall! = 4^(rnd(8)+1) * rnd(4^8)
>

Greeting
Roland
 
Intel Duo E8400 3,0 GHz / 4 GB RAM / 1000 GB HDD - ATI Radeon HD 4770 512 MB - Windows 7 Home Premium 32Bit - XProfan X4
12/11/07  
 




RGH
... and ex the next XProfan-Version there too whom Sonderfall Rnd(), the bislang you don't say so was. the Result is then one Flloatwert >= 0 and < 1. Dann löst Du Dein Problem einfach mit:
CompileMarkSeparation
zufall! = rnd() * 4^16
>

Greeting
Roland
 
Intel Duo E8400 3,0 GHz / 4 GB RAM / 1000 GB HDD - ATI Radeon HD 4770 512 MB - Windows 7 Home Premium 32Bit - XProfan X4
12/11/07  
 




Jörg
Sellmeyer
Very beautiful! any combined values are namely somehow gemauschelt and correspond to not the tatsächlichen probability.
leaves itself here very slight understand:
CompileMarkSeparation
 $H Windows.ph
Set(Decimals,0)
Window 300,10 - 800,1010
Cls
SetDialogFont ~GetStockobject($11)
Declare z!,l&,l1&,l2&,z$,i%,i1%,i2%
l&= Create(ListBox,%hwnd,1,10,10,180,Height(%hwnd)-20)
l1&= Create(ListBox,%hwnd,1,212,10,180,Height(%hwnd)-20)
l2&= Create(ListBox,%hwnd,1,414,10,180,Height(%hwnd)-20)

WhileLoop 20670

    Randomize
    z$=Format$(0000000000,Rnd($7fffffff) + Rnd($7fffffff))

    If Left$(z$,2)= 00

        Inc i%

    EndIf

    Case SelectString(l&,-1,z$) = -1:AddString(l&, z$)
    z$=Format$(00000,Rnd(256^2))

    If Left$(z$,2)= 00

        Inc i1%

    EndIf

    Case SelectString(l1&,-1,z$) = -1:AddString(l1&, z$) +   + Format$(0000000000,Rnd(256^2))
    z$=Format$(00000,(Rnd(256)+1) * Rnd(256))

    If Left$(z$,2)= 00

        Inc i2%

    EndIf

    Case SelectString(l2&,-1,z$) = -1:AddString(l2&, z$) +   + Format$(0000000000,Rnd(256^2))
    WindowTitle Str$(i%) +   + Str$(i1%) +   + Str$(i2%) +   + Str$(&Loop)

Wend

waitkey
 
Windows XP SP2 XProfan X4
... und hier mal was ganz anderes als Profan ...
12/11/07  
 



RGH
... and ex the next XProfan-Version there too whom Sonderfall Rnd(), the bislang you don't say so was. the Result is then one Flloatwert >= 0 and < 1. Dann löst Du Dein Problem einfach mit:
CompileMarkSeparation
zufall! = rnd() * 4^16
>

Greeting
Roland


Jau this is super!

@Jörg: You greifst so on a vergänglichen BeitragsCache To, Frank having its Posting deleted.
 
12/11/07  
 




Jörg
Sellmeyer
These new Possibility is in the Help none erwähnt!
 
Windows XP SP2 XProfan X4
... und hier mal was ganz anderes als Profan ...
08/07/08  
 




Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

4.806 Views

Untitledvor 0 min.
RudiB.05/17/20
Pauli04/15/13
Jörg Sellmeyer11/13/11

Themeninformationen



Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie