Difference between revisions of "Code Snippet: Random Fractions"
From Coder Merlin
(Created page with "= Generate a Random Fraction = == Swift == <syntaxhighlight lang="swift"> // Generate a fraction and print the result let fraction = Float.random(in: 0 ..< 1) print(fraction)...") |
|||
(2 intermediate revisions by 2 users not shown) | |||
Line 8: | Line 8: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== | == Java == | ||
<syntaxhighlight lang="java"> | |||
// Import the random class in java.util | |||
Random random = new Random(); | |||
</syntaxhighlight> | |||
== Perl == | |||
<syntaxhighlight lang="perl"> | |||
print rand(1), "\n"; | |||
</syntaxhighlight> |
Latest revision as of 09:31, 19 September 2019
Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder