Go Package math: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 6: Line 6:
=Internal=
=Internal=


* [[Go Concepts - Standard Library#Packages|Standard Library]]
* [[Go_Language_Modularization#math|Standard Library]]


=Random Numbers=
=Random Numbers=
Line 13: Line 13:
:https://gobyexample.com/random-numbers<br>
:https://gobyexample.com/random-numbers<br>
</blockquote>
</blockquote>
To get a pseudo-random non-negative int between 0 (inclusive) and n (exclusive), use:
<pre>
rand.Intn(n int) int
</pre>

Latest revision as of 22:14, 6 September 2023

External

Internal

Random Numbers

https://gobyexample.com/random-numbers

To get a pseudo-random non-negative int between 0 (inclusive) and n (exclusive), use:

rand.Intn(n int) int