Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Simple "Random int between two numbers" method

Featured Replies

	public static int rndmInt(boolean allowMinimum, int minimum, int maximum, boolean allowMaximum) {
		int min = minimum + (allowMinimum ? 0 : 1);
		int max = maximum  + (allowMaximum ? 1 : 0);
		return new Random().nextInt(max - min) + min;
	}

81104a7da9bf111c09aee6cfea1b34f4.png

^it's "exclusive" not "exlusive".

Edited by Botrepreneur

  • Author

Wouldn't MethodProvider.random(int,int) do the same. If you don't want to allow max or min, you reduce the interval?

 

Yep, this is to help people understand some of the mechanics behind such methods.

I prefer booleans to include / exclude limits, not the most type-friendly way to go, but improves the readability imo.

If you really want people to learn from this you probably should use the words exclusive and inclusive instead of allowed.

If you really want people to learn from this you probably should use the words exclusive and inclusive instead of allowed.

If you look at his comments, they say inclusive and exclusive. The way he did it is better than saying only inclusive and exclusive, because now people can look at his comments and make the connection to the method itsself. From that they can get that allow means inclusive and allow' would be non inclusive.

  • Author

If you really want people to learn from this you probably should use the words exclusive and inclusive instead of allowed.

 

I actually used includeMin and excludeMax as argument names first.

But then I though "allow" would be more comprehensible. Meh, not a huge difference anyways.

If you look at his comments, they say inclusive and exclusive. The way he did it is better than saying only inclusive and exclusive, because now people can look at his comments and make the connection to the method itsself. From that they can get that allow means inclusive and allow' would be non inclusive.

How are people supposed to learn if you have to dumb down simple vocab words?
  • Author

How are people supposed to learn if you have to dumb down simple vocab words?

 

Dumb -> less dumb -> almost smart -> smart.

You have to start somewhere ^^

Dumb -> less dumb -> almost smart -> smart.

You have to start somewhere ^^

An autistic kid has basic knowledge of simple prefixes.

How are people supposed to learn if you have to dumb down simple vocab words?

By your logic we don't even need dictionaries. Why should we ever look at a dictionary? Why not just magically know every word ever naturally?

We need to learn somewhere, typically by making relations, which is exactly what he did.

Questionable.

asexual gtfo

 

By your logic we don't even need dictionaries. Why should we ever look at a dictionary? Why not just magically know every word ever naturally?

We need to learn somewhere, typically by making relations, which is exactly what he did.

That is probably the worst comparison to this topic you could have ever came up with.

 

Jeez, all I do is make a logical suggestion and everyone goes ape shit.

asexual gtfo

 

That is probably the worst comparison to this topic you could have ever came up with.

 

Jeez, all I do is make a logical suggestion and everyone goes ape shit.

@wyd

Guest
This topic is now closed to further replies.

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.