Autor Beitrag
jamal
Hält's aus hier
Beiträge: 2



BeitragVerfasst: Mi 25.10.06 10:40 
hallo,
ich bin Schüler und habe Delphi4 von der Schule bekommen!
Wir sollen eine Rechensoftware für Potentfunkzionen programmieren.
Ich bin fast fertig, aber ich möchte wissen, wie man bei random auch eine negative Zahl aktivieren kann...!
also z.B exponent1:=random(...)...

ICh hoff ihr könnt mir helfen

bis dann Jamal
freak4fun
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 604
Erhaltene Danke: 4

Win 7 Pro
VS 2013 Express, Delphi, C#, PHP, Java
BeitragVerfasst: Mi 25.10.06 10:43 
Lass dir eine positive Zahl zurückgeben und multipliziere sie mit -1. ;)

_________________
"Ich werde auf GAR KEINEN Fall…!" - "Keks?" - "Okay, ich tu's."
i++; // zaehler i um 1 erhoehen
jamal Threadstarter
Hält's aus hier
Beiträge: 2



BeitragVerfasst: Mi 25.10.06 10:46 
okay danke, :D
ich probiere es jetzt mal aus.

Wir sehen uns
:wink:
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mi 25.10.06 10:48 
Moin und :welcome: im Forum!

Wie wäre es mit:
ausblenden Delphi-Quelltext
1:
Zahl := Random(11) -5; // liefert -5..5					

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Mo 06.11.06 19:55 
*Auch noch ne Lösung anbieten will*
ausblenden Delphi-Quelltext
1:
2:
X := RandomRange(-10, 10);     // -> Zahlen zwischen -10 und +10
Y := RandomRange(-100, -1);    // -> Zahlen zwischen -1 und -100

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Mo 06.11.06 20:00 
user profile iconGTA-Place hat folgendes geschrieben:
*Auch noch ne Lösung anbieten will*
ausblenden Delphi-Quelltext
1:
2:
X := RandomRange(-10, 10);     // -> Zahlen zwischen -10 und +10
Y := RandomRange(-100, -1);    // -> Zahlen zwischen -1 und -100

GTA kennt aber auch die verrücktesten Routinen :eyecrazy:
;)

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot