Properties
Similar Topics
Statistics
Comments
4
Participants
5
Subscribers
26
Votes
1
Views
1211
Share
Answered
Hallo,
ich möchte Zufallszahlen, zwischen -1 und 1 erzeugen. Mit [ ] bekomme ich zwar Dezimalzahlen, aber ich erhalte keine negativen Zahlen? Habe es auch schon mit { } versucht.
Was muss ich tun?
danke für die Antwort
- GeoGebra
- Help
- Partners
-
Contact us
- Feedback & Questions
- This email address is being protected from spambots. You need JavaScript enabled to view it.
- +43 677 6137 2693
© 2023 International GeoGebra Institute
The function random() generates a number in [0,1].
You could use -random() to get negative numbers in [-1,0], then arrange the results properly to fit your needs, e.g. in a list, or create another random number that decides whether picking the positive or negative random number you've just created.
It all depends on what you need to do with your random numbers. :)
Sie können auch ein Zufallszahl definieren wie a = Zufallszahl(-10, 10) / 10 oder b= Zufallszahl(-100, 100) / 100.
chris
"ich möchte Zufallszahlen, zwischen -1 und 1 erzeugen."
a=2*random()-1
liefert das Gewünschte.
Comments have been locked on this page!