19 Commits

Author SHA1 Message Date
Raul Santos
cea78730d0 [.NET] Use collection expressions
As of C# 12 we can now use collection expressions to reduce some boilerplate when initializing collections.
2024-12-21 03:38:42 +01:00
ssBandit
892322b5b1 Add C# code to random_number_generation and fix shuffle bag example. (#8072)
* Add C# code to random_number_generation and fix shuffle bag example.

Changes made to shuffle bag example:
- Replace .empty() with .is_empty()
- More descriptive comment
- Change code-block into a tabbed code block

---------

Co-authored-by: Paul Joannon <437025+paulloz@users.noreply.github.com>
Co-authored-by: Raul Santos <raulsntos@gmail.com>
Co-authored-by: tetrapod <145553014+tetrapod00@users.noreply.github.com>
2024-11-19 16:37:18 -08:00
Hugo Locurcio
e402984a8a Document rand_weighted() in Random number generation (#10283)
* Document `rand_weighted()` in Random number generation

---------

Co-authored-by: Max Hilbrunner <mhilbrunner@users.noreply.github.com>
2024-11-18 20:20:10 +01:00
Hugo Locurcio
2d9aeb9740 Update Random number generation for Godot 4.2+ (#9822)
- Document `Array.pick_random()` as a shorthand.
- Use global scope random methods as they are all available in global scope now.
- Remove calls to `randomize()` that are not needed for code samples
  to be functional, as the engine now calls `randomize()` on startup
  once automatically.
2024-11-13 13:59:04 +01:00
Dan Brook
e1e3e4b157 Change call from empty to is_empty in RNG tutorial
The `empty` method was renamed to `is_empty` somewhere between 3.x and
4.x so the code in the tutorial just needed to be brought up to date.

This was brought to light by someone in the Godot server on the #beginner-2
channel noticing an error when running that code:

  https://discord.com/channels/212250894228652034/762480166248513577/1218050947385786438
2024-03-15 11:30:48 +07:00
Hugo Locurcio
ca3c2e9e8d Document cryptographically secure random number generation
- Mention which PRNG Godot internally uses.
2023-10-28 02:32:08 +02:00
Anthony Good
a54fffd60a Access NoiseType on FastNoiseLite class
Fixes 'Identifier "NoiseType" not declared in the current scope' when following example.
2023-06-01 20:44:17 +01:00
Clemens Tolboom
36c87b3400 Make more explicit there are noise_types. (#6802)
* Make more explicit there are noise_types.

It helped me to convert https://docs.godotengine.org/en/stable/classes/class_opensimplexnoise.html to know of types in this example.
2023-02-24 15:09:02 +01:00
Clemens Tolboom
34712bb919 There is no 4D noise in base Noise 2023-02-22 16:00:54 +01:00
Raul Santos
b319da3f07 Update some C# examples for 4.0 (#6693)
* Update some C# examples

- Rename members that have been renamed in Godot's C# API for 4.0.
- Change `delta` parameter type to `double`.
- Ensure parameters match base declaration.
- Other minor code fixes.

---------

Co-authored-by: Paul Joannon <437025+paulloz@users.noreply.github.com>
2023-02-04 17:03:03 +01:00
Yuri Rubinsky
d85afb42f5 Remove incorrect sentence in tutorial of random_number_generation 2022-12-15 15:05:07 +03:00
Max Hilbrunner
99d3d0be12 Renames / fixes for Godot 4 2022-10-17 00:35:07 +02:00
Saarg
5f53d1d03d Update references to OpenSimplexNoise to use FastNoiseLite 2022-08-16 17:50:48 -04:00
Aaron Franke
da14b8000d Add C# code examples (salvage of VinnNo's PRs) 2022-04-29 08:08:09 -05:00
soringherghisan
94ff2dde80 Random number generation: Fix comment for randi_range() example (#4998) 2021-06-15 19:09:20 +02:00
zacryol
1fc21c57ec Fix description of randfn() in Random number generation (#4759) 2021-03-16 22:05:06 +01:00
Hugo Locurcio
5b66b08787 Fix syntax error in the randi_range() example in the RNG tutorial 2020-10-02 13:39:49 +02:00
Nathan Lovato
5546ec3f90 Edit random_numbers.rst
Remove parens, passive voice -> direct voice, fix some typos, simplify some of the language, and add a short intro listing what the reader will learn
2020-09-30 16:42:28 -06:00
Hugo Locurcio
7d9ffa77a7 Add a random number generation tutorial
This closes #2436.
2020-09-30 16:42:22 +02:00